Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
05-17-2021 12:22 AM
I have the following legacy relationship entity which I'd like to upgrade to the latest SDN with @RelationshipProperties
and @TargetNode
:
@RelationshipEntity(type = "HAS_VALUE_ON")
public class RelationshipValue {
@Id
@GeneratedValue
private Long graphId;
@StartNode
private Decision decision;
@EndNode
private Characteristic characteristic;
Could you please show how to implement it with @RelationshipProperties
and @TargetNode
annotations ?
Solved! Go to Solution.
05-17-2021 08:01 AM
A relationship with properties does not point towards both entities anymore but is a directed relationship. We do not make any assumptions if the TargetNode
is an end or a start node. This is defined in the relationship-defining class.
Assuming the RelationshipValue
is used in Decision
and this should get connected to Characteristic
, you would define something like:
@RelationshipProperties
public class RelationshipValue {
@Id
@GeneratedValue
private Long graphId;
@TargetNode
private Characteristic characteristic;
and in Decision
public class Decision {
@Relationship("HAS_VALUE_ON") // direction can be OUTGOING (default) or INCOMING
private RelationshipValue relationshipValue;
}
05-17-2021 08:01 AM
A relationship with properties does not point towards both entities anymore but is a directed relationship. We do not make any assumptions if the TargetNode
is an end or a start node. This is defined in the relationship-defining class.
Assuming the RelationshipValue
is used in Decision
and this should get connected to Characteristic
, you would define something like:
@RelationshipProperties
public class RelationshipValue {
@Id
@GeneratedValue
private Long graphId;
@TargetNode
private Characteristic characteristic;
and in Decision
public class Decision {
@Relationship("HAS_VALUE_ON") // direction can be OUTGOING (default) or INCOMING
private RelationshipValue relationshipValue;
}
10-28-2022 12:22 AM
I am little late to the party but i am facing a similiar situation. We want to upgrade to the latest SDN. I am using the above example to explain our problem. We are accessing the decision property of the RelationshipValue class in our codebase several times. Now, when we upgrade this class property is removed because the new class only points towards the characteristic attribute.
Any idea how to solve that problem? Seems like i have to load the decision now when i need the relation?
11-25-2021 08:47 AM
@gerrit.meier , In the code of the class RelationshipValue there is no extra data so we can skip the definition of the class, but when we add some fields it will be somehow complecated
Please is there any information about using spring data rest with SDN 6 to persist RealtionshipProperties through an HTTP request
All the sessions of the conference are now available online