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