borinquenkid commented on code in PR #16820:
URL: https://github.com/apache/grails-core/pull/16820#discussion_r4438493106


##########
grails-datamapping-core/src/main/groovy/grails/gorm/DetachedCriteria.groovy:
##########
@@ -739,7 +742,7 @@ class DetachedCriteria<T> extends 
AbstractDetachedCriteria<T> implements GormOpe
 
         GormStaticApi staticApi = 
GormRegistry.instance.findStaticApi(targetClass, connectionName)
         staticApi.withDatastoreSession { Session session ->
-            applyLazyCriteria()
+            DetachedCriteria<T> effective = materializeLazyCriteria()
             Query query
             if (alias && (session instanceof QueryAliasAwareSession)) {
                 query = session.createQuery(targetClass, alias)

Review Comment:
   Fixed in e9e562667f: `withPopulatedQuery` now reads `effective.alias` for 
both the alias check and the `session.createQuery(...)` argument, so an alias 
set by a deferred closure reaches alias-aware backends. 
`DetachedCriteriaCloneSpec` covers the materialized copy.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to