jamesfredley commented on code in PR #16773:
URL: https://github.com/apache/grails-core/pull/16773#discussion_r4420902945


##########
grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/query/AliasRegistry.java:
##########
@@ -46,33 +56,52 @@ public void realize(String alias, Expression<?> expression) 
{
         realizedExpressions.put(alias, expression);
     }
 
+    public boolean hasLocalDefinition(String alias) {
+        return definitions.containsKey(alias);
+    }
+
+    public boolean isExplicit(String alias) {
+        HibernateAlias def = definitions.get(alias);
+        if (def != null) {
+            return def.explicit();
+        }
+        if (realizedExpressions.containsKey(alias)) {

Review Comment:
   An outer `DetachedCriteria` on the pet does `owner { eq('firstName', 'Ned'); 
eqProperty('firstName', 'owner.firstName') }`, then an `in('name', ...)` 
subquery that should project its own owner's first name. The comparison 
realizes the tracked `owner` join with no definition, `isExplicit()` becomes 
true, and the subquery projects the outer `Ned` instead of joining its owner. 
The pet that should match is missing. Keep sibling isolation, and keep an 
implicit join implicit when it is realized.



-- 
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