Skip to content

Commit 302b538

Browse files
committed
GH-2655 - Find child relationships reliable.
Don't exclude relationships only by their field name but also by their target entity.
1 parent 77c04db commit 302b538

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/org/springframework/data/neo4j/core/mapping/DefaultNeo4jPersistentEntity.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -470,8 +470,9 @@ public Collection<RelationshipDescription> getRelationshipsInHierarchy(Predicate
470470
childDescription.getRelationships().forEach(concreteRelationship -> {
471471

472472
String fieldName = concreteRelationship.getFieldName();
473+
NodeDescription<?> target = concreteRelationship.getTarget();
473474

474-
if (relationships.stream().noneMatch(relationship -> relationship.getFieldName().equals(fieldName))) {
475+
if (relationships.stream().noneMatch(relationship -> relationship.getFieldName().equals(fieldName) && relationship.getTarget().equals(target))) {
475476
relationships.add(concreteRelationship);
476477
}
477478
});

0 commit comments

Comments
 (0)