Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
02-19-2021 07:39 AM
Hi all, I have a conceptual question in terms of persisting relationships with properties. I've googled and seems @RelationshipEntity is the way to go, however all references I've seen of it come from the OGM dependency (like "org.neo4j.ogm.annotation" for example).
Is there a way to achieve this by using SDN? I wouldn't assume this is the way; I've heard the new SDN version is isolated from OGM. Or maybe my assumption is not correct?
Solved! Go to Solution.
02-19-2021 07:47 AM
Quick recap:
SDN 5 and lower use Neo4j-OGM as the mapping framework
SDN 6 is a standalone solution without Neo4j-OGM
From what we have learned with RelationshipEntity
also from the user perspective, we decided to downgrade relationships with properties from a first class entity to a rich connection between @Node
entities.
This means that we still support relationship with properties (SDN 6 documentation - Relationship properties) but you cannot work with them directly and have to use the relationship defining entities (nodes) to load, modify and persist them.
02-19-2021 07:47 AM
Quick recap:
SDN 5 and lower use Neo4j-OGM as the mapping framework
SDN 6 is a standalone solution without Neo4j-OGM
From what we have learned with RelationshipEntity
also from the user perspective, we decided to downgrade relationships with properties from a first class entity to a rich connection between @Node
entities.
This means that we still support relationship with properties (SDN 6 documentation - Relationship properties) but you cannot work with them directly and have to use the relationship defining entities (nodes) to load, modify and persist them.
02-19-2021 07:51 AM
Thank you, this completely clears the questions I had.
05-29-2022 07:46 AM
Hi, I have the same question but the answer is not very clear to me. How to use the relationship defining entities (nodes) to load, modify and persist relationship properties exactly? The documentation mentions @RelationshipProperties is the way but doing that doesn't create any relationships at all. Same issue here by another user: java - Relationship not saved in SDN 6 (Spring data neo4j) - Stack Overflow
05-29-2022 07:46 PM
Finally, I discovered that the issue with persisting relationship properties using @RelationshipProperty
annotated class is due to the implicit conversion between long and Long. Changing @RelationshipId private long id;
to @RelationshipId private Long id;
inside the @RelationshipProperty
annotated class will do the trick. This appears to be a bug in SDN, it should report an error instead.
All the sessions of the conference are now available online