@Query shortestPath return type in Spring Data Neo4j

1.2k Views Asked by At

What's the return Type of the following query and how do I use it? I tried several things like Path, Iterable<Path>, and others but I always hit some sort of exceptions. It seems to be a LinkedHashMap but are there any other handier object types that I can use?

@Query( "START u1=node:User(key= {0}), u2=node:User(key = {1}) " +
        "MATCH p = shortestPath(u1-[*]-u2) " +
        "RETURN p")
public ??? findShortestPath(String u1, String u2);

Am I missing any dependencies? This is the only one that I'm using:

<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-neo4j-rest</artifactId>
    <version>2.1.0.RELEASE</version>
</dependency>
1

There are 1 best solutions below

0
jotomo On

The return type is EndResult<EntityPath<S, E>>, where S is the start node type of the path, and E the end node type.