'target' node in Neo4j association queries needs to be qualified with a label

Description

The query for @OneToMany is insufficient when there are multiple of them in a class, each mapped by an identically-named field in the associated class. We have an entity class with two 'children' collections, and each 'child' entity references the parent with the field named 'parent'.

It generates the following for each children collection, which picks up both kinds of children in a single query:

MATCH (owner:ENTITYARENT_CLASS` {dbId: 54}) [rarent] (target) RETURN id(target), r, owner, target ORDER BY id(target);

The query should probably be:

MATCH (owner:ENTITYARENT_CLASS` {dbId: 54}) [rarent] (target:CHILD_CLASS) RETURN id(target), r, owner, target ORDER BY id(target);

The workaround is to change the 'parent' field name in one of them.

Environment

None

Status

Assignee

Davide D'Alto

Reporter

Hubert Holierhoek

Labels

None

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Affects versions

5.1.0.Final

Priority

Minor
Configure