@Query shortestPath return type in Spring Data Neo4j

此生再无相见时 提交于 2019-12-07 14:42:08

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!