@@ -342,24 +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- 
353- 			// check intermediate types 
354- 			NodeDescription <?> parentNodeDescription  = concreteNodeDescription .getParentNodeDescription ();
355- 			while  (parentNodeDescription  != null  && parentNodeDescription  != concreteNodeDescription ) {
356- 				((Neo4jPersistentEntity <?>) parentNodeDescription ).doWithAssociations (
357- 						populateFrom (queryResult , propertyAccessor , isConstructorParameter , objectAlreadyMapped , relationshipsFromResult , nodesFromResult ));
358- 				parentNodeDescription  = parentNodeDescription .getParentNodeDescription ();
359- 			}
360- 		}
361345		concreteNodeDescription .doWithAssociations (
362- 				populateFrom (queryResult , propertyAccessor , isConstructorParameter , objectAlreadyMapped , relationshipsFromResult , nodesFromResult ));
346+ 				populateFrom (queryResult , nodeDescription ,  propertyAccessor , isConstructorParameter , objectAlreadyMapped , relationshipsFromResult , nodesFromResult ));
363347	}
364348
365349	@ Nullable 
@@ -440,12 +424,12 @@ public <T> T getParameterValue(PreferredConstructor.Parameter<T, Neo4jPersistent
440424					// If we cannot find any value it does not mean that there isn't any. 
441425					// The result set might contain associations not named CONCRETE_TYPE_TARGET but ABSTRACT_TYPE_TARGET. 
442426					// For this we bubble up the hierarchy of NodeDescriptions. 
443- 					result  = createInstanceOfRelationships (matchingProperty , values , relationshipDescription , relationshipsFromResult ,  nodesFromResult ,  null )
427+ 					result  = createInstanceOfRelationships (matchingProperty , values , relationshipDescription , nodeDescription ,  relationshipsFromResult ,  nodesFromResult )
444428							.orElseGet (() -> {
445429								NodeDescription <?> parentNodeDescription  = nodeDescription .getParentNodeDescription ();
446430								T  resultValue  = null ;
447431								while  (parentNodeDescription  != null ) {
448- 									Optional <Object > value  = createInstanceOfRelationships (matchingProperty , values , relationshipDescription , relationshipsFromResult ,  nodesFromResult ,  parentNodeDescription );
432+ 									Optional <Object > value  = createInstanceOfRelationships (matchingProperty , values , relationshipDescription , parentNodeDescription ,  relationshipsFromResult ,  nodesFromResult );
449433									if  (value .isPresent ()) {
450434										resultValue  = (T ) value .get ();
451435										break ;
@@ -499,7 +483,7 @@ private static Object getValueOrDefault(boolean ownerIsKotlinType, Class<?> rawT
499483		return  value  == null  && !ownerIsKotlinType  && rawType .isPrimitive () ? ReflectionUtils .getPrimitiveDefault (rawType ) : value ;
500484	}
501485
502- 	private  AssociationHandler <Neo4jPersistentProperty > populateFrom (MapAccessor  queryResult ,
486+ 	private  AssociationHandler <Neo4jPersistentProperty > populateFrom (MapAccessor  queryResult ,  NodeDescription <?>  baseDescription , 
503487			PersistentPropertyAccessor <?> propertyAccessor , Predicate <Neo4jPersistentProperty > isConstructorParameter ,
504488		    boolean  objectAlreadyMapped , Collection <Relationship > relationshipsFromResult , Collection <Node > nodesFromResult ) {
505489
@@ -542,14 +526,14 @@ private AssociationHandler<Neo4jPersistentProperty> populateFrom(MapAccessor que
542526				return ;
543527			}
544528
545- 			createInstanceOfRelationships (persistentProperty , queryResult , (RelationshipDescription ) association , relationshipsFromResult ,  nodesFromResult ,  null )
529+ 			createInstanceOfRelationships (persistentProperty , queryResult , (RelationshipDescription ) association , baseDescription ,  relationshipsFromResult ,  nodesFromResult )
546530					.ifPresent (value  -> propertyAccessor .setProperty (persistentProperty , value ));
547531		};
548532	}
549533
550534	private  Optional <Object > createInstanceOfRelationships (Neo4jPersistentProperty  persistentProperty , MapAccessor  values ,
551- 		   RelationshipDescription  relationshipDescription , Collection <Relationship > relationshipsFromResult ,
552- 		   Collection <Node > nodesFromResult ,  @ Nullable   NodeDescription <?>  nodeDescription ) {
535+ 		   RelationshipDescription  relationshipDescription , NodeDescription <?>  baseDescription ,  Collection <Relationship > relationshipsFromResult ,
536+ 		   Collection <Node > nodesFromResult ) {
553537
554538		String  typeOfRelationship  = relationshipDescription .getType ();
555539		String  sourceLabel  = relationshipDescription .getSource ().getPrimaryLabel ();
@@ -583,13 +567,7 @@ private Optional<Object> createInstanceOfRelationships(Neo4jPersistentProperty p
583567			mappedObjectHandler  = (type , mappedObject ) -> value .add (mappedObject );
584568		}
585569
586- 		// Generate name driven by the (nullable) NodeDescription of necessary, 
587- 		// because it might contain associations not named CONCRETE_TYPE_TARGET but ABSTRACT_TYPE_TARGET 
588- 		String  collectionName  = relationshipDescription .generateRelatedNodesCollectionName (
589- 				nodeDescription  != null 
590- 						? nodeDescription 
591- 						: relationshipDescription .getSource ()
592- 		);
570+ 		String  collectionName  = relationshipDescription .generateRelatedNodesCollectionName (baseDescription );
593571
594572		Value  list  = values .get (collectionName );
595573
0 commit comments