0
我想模拟具有祖先和后代(树状关系)的分层实体。更详细地说,我的实体(节点)有一个父代和一个任意数量的同一类的子代。以下代码是否有效并且是否有更好的实现方法?提取注释是否意味着子集将自动填充,具体取决于有多少个节点作为父节点this.ProductClass?用Spring数据分层建模Neo4J-Neo4J
@NodeEntity
public class ProductClass {
@GraphId
private Long id;
@Indexed
private String name;
private String leveltype;
private String description;
@Fetch
@RelatedTo(type = "PARENT", direction = Direction.INCOMING)
Set<ProductClass> children;
@RelatedTo(type = "PARENT", direction = Direction.OUTGOING)
ProductClass parent;