Skip to content

Commit 792182c

Browse files
committed
GH-2418 - Improve mapping of relationship results.
Closes #2418
1 parent 0e6496e commit 792182c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,15 @@ private <ET> void populateProperties(MapAccessor queryResult, Neo4jPersistentEnt
341341
// reference the start again. Because it is getting still constructed, it won't be in the knownObjects
342342
// store unless we temporarily put it there.
343343
knownObjects.storeObject(internalId, mappedObject);
344+
344345
// Fill associations
346+
// If the nodeDescription is a more abstract class as the concrete node description,
347+
// it might contain associations not named CONCRETE_TYPE_TARGET but ABSTRACT_TYPE_TARGET.
348+
// Those won't get caught by the most concrete node description.
349+
if (nodeDescription != concreteNodeDescription) {
350+
nodeDescription.doWithAssociations(
351+
populateFrom(queryResult, propertyAccessor, isConstructorParameter, objectAlreadyMapped, relationshipsFromResult, nodesFromResult));
352+
}
345353
concreteNodeDescription.doWithAssociations(
346354
populateFrom(queryResult, propertyAccessor, isConstructorParameter, objectAlreadyMapped, relationshipsFromResult, nodesFromResult));
347355
}

0 commit comments

Comments
 (0)