【问题标题】:SDN4 - Neo4j 3.0.6 - neo4j-ogm 2.0.5 : Cannot fetch when findByPropertyParentIdSDN4 - Neo4j 3.0.6 - neo4j-ogm 2.0.5:findByPropertyParentId 时无法获取
【发布时间】:2016-12-02 04:40:10
【问题描述】:

我有两个具有 M-N 关系的类,其中一个具有父类。问题是,我想在调用 leftRightRepository.findByLeftParentId(id) 时返回对象列表,但它总是返回一个空列表。

@NodeEntity
public class Right{

    @GraphId
    Long graphId;

    String id; //random generated UUID

    String name;

    //Properties & Constructor
}


@NodeEntity
public class Left{

    @GraphId
    Long graphId;

    String id; //random generated UUID

    String name;

    ParentClass parent;

    //Properties & Constructor
}

@NodeEntity
public class ParentClass{

    @GraphId
    Long graphId;

    String id; //random generated UUID

    String name;

    //Properties & Constructor
}


@NodeEntity
public class LeftRight {
    @GraphId
    Long graphId;

    String id;

    @Relationship(type = "LEFTRIGHT_LEFT", direction = "OUTGOING")
    private Left left;

    @Relationship(type = "LEFTRIGHT_RIGHT", direction = "OUTGOING")
    private Right right;

    //Properties & Constructor
}

为了方便起见,我附上我的节点图片

当我检查 findAll(),然后查看属性时,它具有正确的父 ID。是虫子吗?在SDN3,它的工作,但在SDN4,我不能再次使用它。

我尝试了一些解决方法代码,使用 findByLeftId(List ID)。在 SDN3 中它也可以工作,但在 SDN4 中它不能再次工作。

【问题讨论】:

  • SDN 4.1.x 还是 4.2.x?
  • spring-data-neo4j-4.1.3.RELEASE
  • 据我所知,您的代码应该可以工作。可以提供测试数据或您的项目供我们查看吗?
  • 好,我今天提供样例项目。
  • @Luanne 这里是示例项目。 github.com/daviduck123/spring-data-neo4j-4

标签: java spring spring-data-neo4j-4 neo4j-ogm


【解决方案1】:

SDN 4 / Neo4j OGM 目前仅支持一级嵌套。您尝试执行的查找器是两级嵌套:LeftRight->left->parent

现在唯一的选择是自定义@Query。

也许您还可以记录功能请求here

【讨论】:

  • 好的,我已经创建了问题,感谢您的时间和解释。
猜你喜欢
  • 1970-01-01
  • 2017-03-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多