问题
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:
The return type is EndResult<EntityPath<S, E>
, where S is the start node of the path, and E the end type.
来源:https://stackoverflow.com/questions/13424372/query-shortestpath-return-type-in-spring-data-neo4j