cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

How to save entity with relationships and relationship has some relationship properites

How to persist relationship between 2 entities with relationship properties..

In java using OGM

1 REPLY 1

Balatriven, Look at the OGM manual here (2.4.3) https://neo4j.com/docs/ogm-manual/current/tutorial/#tutorial:annotations:relationship-entities

Your relationship is really a new java Object that defines the @StartNode and @EndNode, along with any other attributes/properties you want to add. The StartNode and EndNode refers to the node labels (java Classes) that use that relationship.

In your java Class that represents the StartNode, add an @Relationship for the set (or attribute ) of RelationshipEntity object(s). OGM draws the graph the way you would expect. Your java code will have to include the necessary code to get() and set() the objects at StartNode and EndNode.

...at least, that's the way I've made it work.