@@ -342,16 +342,8 @@ private <ET> void populateProperties(MapAccessor queryResult, Neo4jPersistentEnt
342
342
// store unless we temporarily put it there.
343
343
knownObjects .storeObject (internalId , mappedObject );
344
344
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
- }
353
345
concreteNodeDescription .doWithAssociations (
354
- populateFrom (queryResult , propertyAccessor , isConstructorParameter , objectAlreadyMapped , relationshipsFromResult , nodesFromResult ));
346
+ populateFrom (queryResult , nodeDescription , propertyAccessor , isConstructorParameter , objectAlreadyMapped , relationshipsFromResult , nodesFromResult ));
355
347
}
356
348
357
349
@ Nullable
@@ -432,12 +424,12 @@ public <T> T getParameterValue(PreferredConstructor.Parameter<T, Neo4jPersistent
432
424
// If we cannot find any value it does not mean that there isn't any.
433
425
// The result set might contain associations not named CONCRETE_TYPE_TARGET but ABSTRACT_TYPE_TARGET.
434
426
// 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 )
436
428
.orElseGet (() -> {
437
429
NodeDescription <?> parentNodeDescription = nodeDescription .getParentNodeDescription ();
438
430
T resultValue = null ;
439
431
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 );
441
433
if (value .isPresent ()) {
442
434
resultValue = (T ) value .get ();
443
435
break ;
@@ -491,7 +483,7 @@ private static Object getValueOrDefault(boolean ownerIsKotlinType, Class<?> rawT
491
483
return value == null && !ownerIsKotlinType && rawType .isPrimitive () ? ReflectionUtils .getPrimitiveDefault (rawType ) : value ;
492
484
}
493
485
494
- private AssociationHandler <Neo4jPersistentProperty > populateFrom (MapAccessor queryResult ,
486
+ private AssociationHandler <Neo4jPersistentProperty > populateFrom (MapAccessor queryResult , NodeDescription <?> baseDescription ,
495
487
PersistentPropertyAccessor <?> propertyAccessor , Predicate <Neo4jPersistentProperty > isConstructorParameter ,
496
488
boolean objectAlreadyMapped , Collection <Relationship > relationshipsFromResult , Collection <Node > nodesFromResult ) {
497
489
@@ -534,14 +526,14 @@ private AssociationHandler<Neo4jPersistentProperty> populateFrom(MapAccessor que
534
526
return ;
535
527
}
536
528
537
- createInstanceOfRelationships (persistentProperty , queryResult , (RelationshipDescription ) association , relationshipsFromResult , nodesFromResult , null )
529
+ createInstanceOfRelationships (persistentProperty , queryResult , (RelationshipDescription ) association , baseDescription , relationshipsFromResult , nodesFromResult )
538
530
.ifPresent (value -> propertyAccessor .setProperty (persistentProperty , value ));
539
531
};
540
532
}
541
533
542
534
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 ) {
545
537
546
538
String typeOfRelationship = relationshipDescription .getType ();
547
539
String sourceLabel = relationshipDescription .getSource ().getPrimaryLabel ();
@@ -575,13 +567,7 @@ private Optional<Object> createInstanceOfRelationships(Neo4jPersistentProperty p
575
567
mappedObjectHandler = (type , mappedObject ) -> value .add (mappedObject );
576
568
}
577
569
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 );
585
571
586
572
Value list = values .get (collectionName );
587
573
0 commit comments