@@ -278,7 +278,7 @@ private <ET> ET map(MapAccessor queryResult, MapAccessor allValues, Neo4jPersist
278
278
knownObjects .storeObject (internalId , instance );
279
279
// Fill associations
280
280
concreteNodeDescription .doWithAssociations (
281
- populateFrom (queryResult , allValues , propertyAccessor , isConstructorParameter , relationships ));
281
+ populateFrom (queryResult , allValues , propertyAccessor , isConstructorParameter ));
282
282
}
283
283
ET bean = propertyAccessor .getBean ();
284
284
@@ -363,7 +363,12 @@ public Object getParameterValue(PreferredConstructor.Parameter parameter) {
363
363
Neo4jPersistentProperty matchingProperty = nodeDescription .getRequiredPersistentProperty (parameter .getName ());
364
364
365
365
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 );
367
372
} else if (matchingProperty .isDynamicLabels ()) {
368
373
return createDynamicLabelsProperty (matchingProperty .getTypeInformation (), surplusLabels );
369
374
} else if (matchingProperty .isEntityWithRelationshipProperties ()) {
@@ -399,25 +404,21 @@ private PropertyHandler<Neo4jPersistentProperty> populateFrom(MapAccessor queryR
399
404
}
400
405
401
406
private AssociationHandler <Neo4jPersistentProperty > populateFrom (MapAccessor queryResult , MapAccessor allValues ,
402
- PersistentPropertyAccessor <?> propertyAccessor , Predicate <Neo4jPersistentProperty > isConstructorParameter ,
403
- Collection <RelationshipDescription > relationshipDescriptions ) {
407
+ PersistentPropertyAccessor <?> propertyAccessor , Predicate <Neo4jPersistentProperty > isConstructorParameter ) {
404
408
return association -> {
405
409
406
410
Neo4jPersistentProperty persistentProperty = association .getInverse ();
407
411
if (isConstructorParameter .test (persistentProperty )) {
408
412
return ;
409
413
}
410
414
411
- createInstanceOfRelationships (persistentProperty , queryResult , allValues , relationshipDescriptions )
415
+ createInstanceOfRelationships (persistentProperty , queryResult , allValues , ( RelationshipDescription ) association )
412
416
.ifPresent (value -> propertyAccessor .setProperty (persistentProperty , value ));
413
417
};
414
418
}
415
419
416
420
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 ) {
421
422
422
423
String typeOfRelationship = relationshipDescription .getType ();
423
424
String sourceLabel = relationshipDescription .getSource ().getPrimaryLabel ();
0 commit comments