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


##########
grails-data-neo4j/core/src/main/groovy/org/grails/datastore/gorm/neo4j/engine/Neo4jQuery.groovy:
##########
@@ -772,7 +803,19 @@ class Neo4jQuery extends Query {
                 builder.addMatch(
                         
entity.formatAssociationPatternFromExisting(association, relationship, prefix, 
targetNodeName)
                 )
-                return dispatchCriterion(aq.criteria, entity, builder, 
nextPrefix)
+                // The nested criteria are about the associated entity, so a 
property is looked up there: a
+                // plain property of the same name as an association of the 
entity the query started from is
+                // still a plain property, and an association of the 
associated entity is tested as one. An
+                // association to a relationship entity keeps the entity it 
was given, and its variable is
+                // recorded as a relationship: the properties are those of the 
relationship, which has no
+                // relationship of its own to test.
+                PersistentEntity associated = association.associatedEntity
+                GraphPersistentEntity nested = associated instanceof 
GraphPersistentEntity &&
+                        !((GraphPersistentEntity) 
associated).isRelationshipEntity() ? (GraphPersistentEntity) associated : entity
+                if (criterion.entity instanceof RelationshipPersistentEntity) {
+                    builder.addRelationshipVariable(nextPrefix)
+                }
+                return dispatchCriterion(aq.criteria, nested, builder, 
nextPrefix)

Review Comment:
   customer { eq('account', account) } now compares the customer's id column. 
Customer uses a snowflake id and Account uses a native id, so the comparison 
looks for __id__ and matches no order. It used to compare the account's id. Use 
the target of account for that comparison.



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