当然,一个简单的问题,但我找不到我的答案。如何使用Neo4JRepository从关系中获取实体?
Java 8 // Spring Boot 2 // SDN 5.0.9 // OGM 3
有我的代码:
@NodeEntity(label = "category")
public class Category {
private @Id @GeneratedValue(strategy = InternalIdStrategy.class) Long id;
private String name;
@Relationship(type = "MEMBER_OF", direction = Relationship.INCOMING)
private Set<Sport> sports;
}
@NodeEntity(label = "sport")
public class Sport {
private @Id @GeneratedValue(strategy = InternalIdStrategy.class) Long id;
private String name;
private String descrition;
@Relationship(type = "MEMBER_OF")
private Set<Category> categories;
}
@RelationshipEntity(type = "MEMBER_OF")
public class Membership {
@Id
@GeneratedValue
private Long id;
@StartNode
Sport sport;
@EndNode
Category category;
}
我的 Neo4jRepository 中的一个简单 findAll 返回所有节点 Sport,但设置的类别为空
那么,你能告诉我我做错了什么吗?
慕哥9229398
相关分类