@@ -278,7 +278,7 @@ private <ET> ET map(MapAccessor queryResult, MapAccessor allValues, Neo4jPersist
278278 knownObjects .storeObject (internalId , instance );
279279 // Fill associations
280280 concreteNodeDescription .doWithAssociations (
281- populateFrom (queryResult , allValues , propertyAccessor , isConstructorParameter , relationships ));
281+ populateFrom (queryResult , allValues , propertyAccessor , isConstructorParameter ));
282282 }
283283 ET bean = propertyAccessor .getBean ();
284284
@@ -363,7 +363,12 @@ public Object getParameterValue(PreferredConstructor.Parameter parameter) {
363363 Neo4jPersistentProperty matchingProperty = nodeDescription .getRequiredPersistentProperty (parameter .getName ());
364364
365365 if (matchingProperty .isRelationship ()) {
366- return createInstanceOfRelationships (matchingProperty , values , allValues , relationships ).orElse (null );
366+ RelationshipDescription relationshipDescription = nodeDescription .getRelationships ().stream ()
367+ .filter (r -> {
368+ String propertyFieldName = matchingProperty .getFieldName ();
369+ return r .getFieldName ().equals (propertyFieldName );
370+ }).findFirst ().get ();
371+ return createInstanceOfRelationships (matchingProperty , values , allValues , relationshipDescription ).orElse (null );
367372 } else if (matchingProperty .isDynamicLabels ()) {
368373 return createDynamicLabelsProperty (matchingProperty .getTypeInformation (), surplusLabels );
369374 } else if (matchingProperty .isEntityWithRelationshipProperties ()) {
@@ -399,25 +404,21 @@ private PropertyHandler<Neo4jPersistentProperty> populateFrom(MapAccessor queryR
399404 }
400405
401406 private AssociationHandler <Neo4jPersistentProperty > populateFrom (MapAccessor queryResult , MapAccessor allValues ,
402- PersistentPropertyAccessor <?> propertyAccessor , Predicate <Neo4jPersistentProperty > isConstructorParameter ,
403- Collection <RelationshipDescription > relationshipDescriptions ) {
407+ PersistentPropertyAccessor <?> propertyAccessor , Predicate <Neo4jPersistentProperty > isConstructorParameter ) {
404408 return association -> {
405409
406410 Neo4jPersistentProperty persistentProperty = association .getInverse ();
407411 if (isConstructorParameter .test (persistentProperty )) {
408412 return ;
409413 }
410414
411- createInstanceOfRelationships (persistentProperty , queryResult , allValues , relationshipDescriptions )
415+ createInstanceOfRelationships (persistentProperty , queryResult , allValues , ( RelationshipDescription ) association )
412416 .ifPresent (value -> propertyAccessor .setProperty (persistentProperty , value ));
413417 };
414418 }
415419
416420 private Optional <Object > createInstanceOfRelationships (Neo4jPersistentProperty persistentProperty , MapAccessor values ,
417- MapAccessor allValues , Collection <RelationshipDescription > relationshipDescriptions ) {
418-
419- RelationshipDescription relationshipDescription = relationshipDescriptions .stream ()
420- .filter (r -> r .getFieldName ().equals (persistentProperty .getName ())).findFirst ().get ();
421+ MapAccessor allValues , RelationshipDescription relationshipDescription ) {
421422
422423 String typeOfRelationship = relationshipDescription .getType ();
423424 String sourceLabel = relationshipDescription .getSource ().getPrimaryLabel ();
0 commit comments