Search code examples
javaspringspring-data-neo4j-4neo4j-ogm

SDN4 - Neo4j 3.0.6 - neo4j-ogm 2.0.5 : Cannot fetch when findByPropertyParentId


I have two classes that have M-N Relationship and one of that class have Parent Class. The problem is, I want to return list of object when I call leftRightRepository.findByLeftParentId(id) but it always return an empty List.

@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
}

To make it easier, I attach the picture of my Nodes enter image description here

When I check with findAll(), and then look at the property, it have correct parent Id. Is it Bug? In SDN3, Its work, but in SDN4, I cannot use it again.

And I try a little workaround code, with findByLeftId(List ID). In SDN3 it work too, but in SDN4 it not work again.


Solution

  • SDN 4 / Neo4j OGM only supports one level of nesting at this point in time. The finder you are trying to execute is two levels of nesting: LeftRight->left->parent

    The only alternative now is a custom @Query.

    Perhaps you can also log a feature request here