繁体   English   中英

无法使用 neo4j ogm 2.0.6、spring boot 和远程 NEO4J 社区服务器 3.1.1 在 POJO 中“拥有”集合属性

[英]cannot hydrate "owns" collection property in POJO using neo4j ogm 2.0.6, spring boot, and remote NEO4J Community server 3.1.1

不能在简单的POJOowns ”集合属性(注释属性)。 owns财产返回空。

我使用的是 neo4j ogm 2.0.6、spring boot 和远程 NEO4J 社区服务器 3.1.1。

用于填充 db 的 NEO4J 密码查询:

CREATE (n:Entity { name: 'Bank of A', fid: '100' })

CREATE (n:Entity { name: 'Bank of B', fid: '200' })

MATCH (boa:Entity{fid:'100'}), (bob:Entity{fid:'200'}) 
                            CREATE (boa) -[:OWNS]->(bob);

在控制器中:

Entity entity = session.load(Entity.class, neo4jId, 1);
return entity.getOwns(); 

实体集应该包含一个“ Bank of B ”的实例,但返回空集:

@NodeEntity
public class Entity {
    @GraphId Long id;
    private String name;

    @Relationship(type="OWNS")
    private Set<Entity> owns;

    public Entity() {
        this.owns = new HashSet<Entity>();
    }
}

需要传递 -1 作为第三个参数,以使关系急切加载。 Entity entity = session.load(Entity.class, neo4jId, -1);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM