Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/392.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java “不能水合”;拥有;使用neo4j ogm 2.0.6、spring boot和远程neo4j社区服务器3.1.1的POJO中的集合属性_Java_Neo4j_Spring Data Neo4j_Neo4j Ogm - Fatal编程技术网

Java “不能水合”;拥有;使用neo4j ogm 2.0.6、spring boot和远程neo4j社区服务器3.1.1的POJO中的集合属性

Java “不能水合”;拥有;使用neo4j ogm 2.0.6、spring boot和远程neo4j社区服务器3.1.1的POJO中的集合属性,java,neo4j,spring-data-neo4j,neo4j-ogm,Java,Neo4j,Spring Data Neo4j,Neo4j Ogm,无法在简单的POJO中添加“拥有的”集合属性(注释属性)。拥有的属性返回为空 我使用的是neo4j ogm 2.0.6、spring boot和远程neo4j社区服务器3.1.1 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:E

无法在简单的
POJO
中添加“
拥有的
”集合属性(注释属性)。
拥有的
属性返回为空

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

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(); 
在控制器中:

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(); 
实体集应包含“
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>();
    }
}
@NodeEntity
公共类实体{
@长id;
私有字符串名称;
@关系(type=“OWNS”)
私人拥有;
公共实体(){
this.owns=new HashSet();
}
}

需要将-1作为第三个参数传递,以使关系能够快速加载。 实体=session.load(Entity.class,neo4jId,-1)