@@ -342,16 +342,8 @@ private <ET> void populateProperties(MapAccessor queryResult, Neo4jPersistentEnt
342342 // store unless we temporarily put it there.
343343 knownObjects .storeObject (internalId , mappedObject );
344344
345- // 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- }
353345 concreteNodeDescription .doWithAssociations (
354- populateFrom (queryResult , propertyAccessor , isConstructorParameter , objectAlreadyMapped , relationshipsFromResult , nodesFromResult ));
346+ populateFrom (queryResult , nodeDescription , propertyAccessor , isConstructorParameter , objectAlreadyMapped , relationshipsFromResult , nodesFromResult ));
355347 }
356348
357349 @ Nullable
@@ -432,12 +424,12 @@ public <T> T getParameterValue(PreferredConstructor.Parameter<T, Neo4jPersistent
432424 // If we cannot find any value it does not mean that there isn't any.
433425 // The result set might contain associations not named CONCRETE_TYPE_TARGET but ABSTRACT_TYPE_TARGET.
434426 // For this we bubble up the hierarchy of NodeDescriptions.
435- result = createInstanceOfRelationships (matchingProperty , values , relationshipDescription , relationshipsFromResult , nodesFromResult , null )
427+ result = createInstanceOfRelationships (matchingProperty , values , relationshipDescription , nodeDescription , relationshipsFromResult , nodesFromResult )
436428 .orElseGet (() -> {
437429 NodeDescription <?> parentNodeDescription = nodeDescription .getParentNodeDescription ();
438430 T resultValue = null ;
439431 while (parentNodeDescription != null ) {
440- Optional <Object > value = createInstanceOfRelationships (matchingProperty , values , relationshipDescription , relationshipsFromResult , nodesFromResult , parentNodeDescription );
432+ Optional <Object > value = createInstanceOfRelationships (matchingProperty , values , relationshipDescription , parentNodeDescription , relationshipsFromResult , nodesFromResult );
441433 if (value .isPresent ()) {
442434 resultValue = (T ) value .get ();
443435 break ;
@@ -491,7 +483,7 @@ private static Object getValueOrDefault(boolean ownerIsKotlinType, Class<?> rawT
491483 return value == null && !ownerIsKotlinType && rawType .isPrimitive () ? ReflectionUtils .getPrimitiveDefault (rawType ) : value ;
492484 }
493485
494- private AssociationHandler <Neo4jPersistentProperty > populateFrom (MapAccessor queryResult ,
486+ private AssociationHandler <Neo4jPersistentProperty > populateFrom (MapAccessor queryResult , NodeDescription <?> baseDescription ,
495487 PersistentPropertyAccessor <?> propertyAccessor , Predicate <Neo4jPersistentProperty > isConstructorParameter ,
496488 boolean objectAlreadyMapped , Collection <Relationship > relationshipsFromResult , Collection <Node > nodesFromResult ) {
497489
@@ -534,14 +526,14 @@ private AssociationHandler<Neo4jPersistentProperty> populateFrom(MapAccessor que
534526 return ;
535527 }
536528
537- createInstanceOfRelationships (persistentProperty , queryResult , (RelationshipDescription ) association , relationshipsFromResult , nodesFromResult , null )
529+ createInstanceOfRelationships (persistentProperty , queryResult , (RelationshipDescription ) association , baseDescription , relationshipsFromResult , nodesFromResult )
538530 .ifPresent (value -> propertyAccessor .setProperty (persistentProperty , value ));
539531 };
540532 }
541533
542534 private Optional <Object > createInstanceOfRelationships (Neo4jPersistentProperty persistentProperty , MapAccessor values ,
543- RelationshipDescription relationshipDescription , Collection <Relationship > relationshipsFromResult ,
544- Collection <Node > nodesFromResult , @ Nullable NodeDescription <?> nodeDescription ) {
535+ RelationshipDescription relationshipDescription , NodeDescription <?> baseDescription , Collection <Relationship > relationshipsFromResult ,
536+ Collection <Node > nodesFromResult ) {
545537
546538 String typeOfRelationship = relationshipDescription .getType ();
547539 String sourceLabel = relationshipDescription .getSource ().getPrimaryLabel ();
@@ -575,13 +567,7 @@ private Optional<Object> createInstanceOfRelationships(Neo4jPersistentProperty p
575567 mappedObjectHandler = (type , mappedObject ) -> value .add (mappedObject );
576568 }
577569
578- // Generate name driven by the (nullable) NodeDescription of necessary,
579- // because it might contain associations not named CONCRETE_TYPE_TARGET but ABSTRACT_TYPE_TARGET
580- String collectionName = relationshipDescription .generateRelatedNodesCollectionName (
581- nodeDescription != null
582- ? nodeDescription
583- : relationshipDescription .getSource ()
584- );
570+ String collectionName = relationshipDescription .generateRelatedNodesCollectionName (baseDescription );
585571
586572 Value list = values .get (collectionName );
587573
0 commit comments