@@ -283,7 +283,7 @@ private <ET> ET map(MapAccessor queryResult, MapAccessor allValues, Neo4jPersist
283283 knownObjects .storeObject (internalId , instance );
284284 // Fill associations
285285 concreteNodeDescription .doWithAssociations (
286- populateFrom (queryResult , allValues , propertyAccessor , isConstructorParameter , relationships ));
286+ populateFrom (queryResult , allValues , propertyAccessor , isConstructorParameter ));
287287 }
288288 ET bean = propertyAccessor .getBean ();
289289
@@ -368,7 +368,12 @@ public Object getParameterValue(PreferredConstructor.Parameter parameter) {
368368 Neo4jPersistentProperty matchingProperty = nodeDescription .getRequiredPersistentProperty (parameter .getName ());
369369
370370 if (matchingProperty .isRelationship ()) {
371- return createInstanceOfRelationships (matchingProperty , values , allValues , relationships ).orElse (null );
371+ RelationshipDescription relationshipDescription = nodeDescription .getRelationships ().stream ()
372+ .filter (r -> {
373+ String propertyFieldName = matchingProperty .getFieldName ();
374+ return r .getFieldName ().equals (propertyFieldName );
375+ }).findFirst ().get ();
376+ return createInstanceOfRelationships (matchingProperty , values , allValues , relationshipDescription ).orElse (null );
372377 } else if (matchingProperty .isDynamicLabels ()) {
373378 return createDynamicLabelsProperty (matchingProperty .getTypeInformation (), surplusLabels );
374379 } else if (matchingProperty .isEntityWithRelationshipProperties ()) {
@@ -404,25 +409,21 @@ private PropertyHandler<Neo4jPersistentProperty> populateFrom(MapAccessor queryR
404409 }
405410
406411 private AssociationHandler <Neo4jPersistentProperty > populateFrom (MapAccessor queryResult , MapAccessor allValues ,
407- PersistentPropertyAccessor <?> propertyAccessor , Predicate <Neo4jPersistentProperty > isConstructorParameter ,
408- Collection <RelationshipDescription > relationshipDescriptions ) {
412+ PersistentPropertyAccessor <?> propertyAccessor , Predicate <Neo4jPersistentProperty > isConstructorParameter ) {
409413 return association -> {
410414
411415 Neo4jPersistentProperty persistentProperty = association .getInverse ();
412416 if (isConstructorParameter .test (persistentProperty )) {
413417 return ;
414418 }
415419
416- createInstanceOfRelationships (persistentProperty , queryResult , allValues , relationshipDescriptions )
420+ createInstanceOfRelationships (persistentProperty , queryResult , allValues , ( RelationshipDescription ) association )
417421 .ifPresent (value -> propertyAccessor .setProperty (persistentProperty , value ));
418422 };
419423 }
420424
421425 private Optional <Object > createInstanceOfRelationships (Neo4jPersistentProperty persistentProperty , MapAccessor values ,
422- MapAccessor allValues , Collection <RelationshipDescription > relationshipDescriptions ) {
423-
424- RelationshipDescription relationshipDescription = relationshipDescriptions .stream ()
425- .filter (r -> r .getFieldName ().equals (persistentProperty .getName ())).findFirst ().get ();
426+ MapAccessor allValues , RelationshipDescription relationshipDescription ) {
426427
427428 String typeOfRelationship = relationshipDescription .getType ();
428429 String sourceLabel = relationshipDescription .getSource ().getPrimaryLabel ();
0 commit comments