我有以下遗留关系实体,我想将其升级到具有@RelationshipProperties
和@TargetNode
的最新SDN
@RelationshipEntity(type = "HAS_VALUE_ON")
public class RelationshipValue {
@Id
@GeneratedValue
private Long graphId;
@StartNode
private Decision decision;
@EndNode
private Characteristic characteristic;
您能展示一下如何使用@RelationshipProperties
和@TargetNode
注解来实现它吗?
发布于 2021-05-17 23:13:05
具有属性的关系不再指向这两个实体,而是一种有向关系。如果TargetNode是结束节点或开始节点,我们不做任何假设。这是在关系定义类中定义的。假设在Decision中使用了RelationshipValue,并且这应该连接到Characteristic,您将定义如下内容:
@RelationshipProperties
public class RelationshipValue {
@Id
@GeneratedValue
private Long graphId;
@TargetNode
private Characteristic characteristic;
在Decision
中
public class Decision {
@Relationship("HAS_VALUE_ON") // direction can be OUTGOING (default) or INCOMING
private RelationshipValue relationshipValue;
}
https://stackoverflow.com/questions/67558448
复制相似问题