cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

About findBy depth

i use session.load(clazz,id;depth) to query relation,id is relation id,if i set the 0 depth, throw org.neo4j.ogm.exception.core.InvalidDepthException: Cannot load a relationship entity with depth 0 i.e. no start or end node, why can't query? 0 depth doesn't mean query the relationship property?

3 REPLIES 3

You cannot query for a relationship (entity) with depth 0 because Neo4j-OGM is not able to construct correct cypher in this case. Cypher does not allow a standalone relationship but needs a pattern to find the right one.

The depth should be 1 at least to broaden the query to the nodes the relationship (entity) connects.

thanks.now i understand why

i have a question,if load relation by id with depth 1,why neo4j ogm don't provider a function to return startNode and endNode without other relationship.if my node has lots of relationship,current query may have a problem that my program doesn't need other relationship but it return them.