JAVA neo4j密码获取与对象的所有关系

时间:2019-07-20 07:12:12

标签: java session neo4j cypher

我有一个具有关系的JAVA对象:

class SystemUserEntity{
    @Relationship("IN_TENANT")
    private SystemTenantEntity tenant;
    ....
}

我正在运行以下查询以获取具有所有关系的所需对象:

SystemUserEntity entity = 
session.queryForObject(SystemUserEntity.class,
MATCH (n:SystemUserEntity)-[r]-(b) WHERE n.userName = 'admin' RETURN n,r,b);

当我查看neo4j UI (图像1)时,我看到的结果完全符合我的期望-一个具有所有关系的对象,但我得到了例外:Result not of expected size. Expected 1 row but found 2 < / p>

我可以看到为什么会出现异常,因为当我切换到表格模式(图像2)时,实际上看到的是重复的结果。

图像1 enter image description here

图像2 enter image description here

正确获取一个结果与所有关系的正确方法是什么。 在Java会话上下文中

0 个答案:

没有答案