小编Xav*_*ens的帖子

Spring Data Neo4J - 创建与现有节点有关系的新节点

我需要创建一个A类的新节点,它与User节点有关系:

@NodeEntity
public class A implements Serializable {

    /**
     * Graph node identifier
     */
    @GraphId
    private Long nodeId;

    /**
     * Enity identifier
     */
    private String id;

    //... more properties ...

    @Relationship(type = "HAS_ADVERTISER", direction = Relationship.OUTGOING)
    private User user;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof IdentifiableEntity)) return false;

        IdentifiableEntity entity = (IdentifiableEntity) o;
        if (!super.equals(o)) return false;

        if (id != null) {
            if (!id.equals(entity.id)) return false;
        } else {
            if (entity.id …
Run Code Online (Sandbox Code Playgroud)

neo4j spring-data-neo4j spring-data-neo4j-4

5
推荐指数
1
解决办法
1834
查看次数