use of org.neo4j.ogm.exception.core.InvalidDepthException in project neo4j-ogm by neo4j.
the class RelationshipQueryStatements method findByType.
@Override
public PagingAndSortingQuery findByType(String type, Filters parameters, int depth) {
if (depth > 0) {
FilteredQuery query = FilteredQueryBuilder.buildRelationshipQuery(type, parameters);
String matchClause = query.statement() + " WITH DISTINCT(r0) as r0,startnode(r0) AS n, endnode(r0) AS m";
String returnClause = loadClauseBuilder.build("r0", type, depth);
return new PagingAndSortingQuery(matchClause, returnClause, query.parameters(), true, true, "r0");
} else {
throw new InvalidDepthException("Cannot load a relationship entity with depth 0 i.e. no start or end node");
}
}
Aggregations