GH-2655 - Find child relationships reliable.

Don't exclude relationships only by their field name but also by their target entity.
This commit is contained in:
Gerrit Meier
2023-01-18 11:28:17 +01:00
parent 3cf0aa58c9
commit 1ac36603f7

View File

@@ -482,8 +482,9 @@ final class DefaultNeo4jPersistentEntity<T> extends BasicPersistentEntity<T, Neo
childDescription.getRelationships().forEach(concreteRelationship -> {
String fieldName = concreteRelationship.getFieldName();
NodeDescription<?> target = concreteRelationship.getTarget();
if (relationships.stream().noneMatch(relationship -> relationship.getFieldName().equals(fieldName))) {
if (relationships.stream().noneMatch(relationship -> relationship.getFieldName().equals(fieldName) && relationship.getTarget().equals(target))) {
relationships.add(concreteRelationship);
}
});