Skip to content

Commit 19d1fc7

Browse files
committed
GH-2241 - Never return null for empty collections.
There could be the case that for collections instead of an empty instance, SDN would return null. This was because the value were never touched for setting. Also this was not deterministic because it was depending on the random order the properties of an entity were processed. Closes #2241
1 parent 7347566 commit 19d1fc7

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,6 @@ private Optional<Object> createInstanceOfRelationships(Neo4jPersistentProperty p
474474
.filter(n -> n.hasLabel(targetLabel)).collect(Collectors.toList())
475475
.forEach(allNodesWithMatchingLabelInResult::add);
476476

477-
if (allNodesWithMatchingLabelInResult.isEmpty() || allMatchingTypeRelationshipsInResult.isEmpty()) {
478-
return Optional.empty();
479-
}
480-
481477
Function<Relationship, Long> targetIdSelector = relationshipDescription.isIncoming() ? Relationship::startNodeId : Relationship::endNodeId;
482478
Function<Relationship, Long> sourceIdSelector = relationshipDescription.isIncoming() ? Relationship::endNodeId : Relationship::startNodeId;
483479
Long sourceNodeId = getInternalId(values);

0 commit comments

Comments
 (0)