Skip to content

Commit ad07e1c

Browse files
committed
GH-2418 - Improve mapping of relationship results.
Closes #2418
1 parent 9e14043 commit ad07e1c

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
@@ -340,7 +340,15 @@ private <ET> void populateProperties(MapAccessor queryResult, Neo4jPersistentEnt
340340
// reference the start again. Because it is getting still constructed, it won't be in the knownObjects
341341
// store unless we temporarily put it there.
342342
knownObjects.storeObject(internalId, mappedObject);
343+
343344
// Fill associations
345+
// If the nodeDescription is a more abstract class as the concrete node description,
346+
// it might contain associations not named CONCRETE_TYPE_TARGET but ABSTRACT_TYPE_TARGET.
347+
// Those won't get caught by the most concrete node description.
348+
if (nodeDescription != concreteNodeDescription) {
349+
nodeDescription.doWithAssociations(
350+
populateFrom(queryResult, propertyAccessor, isConstructorParameter, objectAlreadyMapped, relationshipsFromResult, nodesFromResult));
351+
}
344352
concreteNodeDescription.doWithAssociations(
345353
populateFrom(queryResult, propertyAccessor, isConstructorParameter, objectAlreadyMapped, relationshipsFromResult, nodesFromResult));
346354
}

0 commit comments

Comments
 (0)