What steps will reproduce the problem?
from roo shell execute command(assuming that neo4j project is set up and ~.domain.Person entity is created)
roo> graph relationship --fieldName friends --from ~.domain.Person --to ~.domain.Person --via ~.relations.Friendship --cardinality MANY_TO_MANY --type "Friendship"
What is the expected output? What do you see instead?
Addon should add field
@RelatedToVia(type = "Friendship", direction = Direction.BOTH, elementClass = Friendship.class)
private final Iterable<Friendship> friends = null;
but instead error appears:
Other NodeEntity to com.example.domain.Person not found in relationship
What version of the product are you using? On what operating system?
neo4j-roo-addon 1.1.0.RELEASE
spring roo 1.1.5.RELEASE
Please provide any additional information below.
To solve this issue, please apply my patch from attachment. Two thins are changed:
1) when determining other type of the relationship error is not thrown is there exists exactly one @StartNode and one @EndNode in RelationshipEntity (this simple check is done to determine problems that user might manually introduce when modifying generated RelationshipEntity)
2) added direction constant org.springframework.roo.addon.graph.Direction.BOTH that was missing in the addon enum file (even tough it exists in org.springframework.data.neo4j.core.Direction enum that is used in generated code) as it makes sense to include both incomming and outgoing related nodes when startNode and endNode types are the same.
It also seems to work properly without any further modifications as Spring data graph supports it out of the box.
3.9 KB View Download