凝_华 2024-01-04 10:14 采纳率: 0%
浏览 22

neo4j在springboot中的路径查询

spring boot 整合neo4j 5 ,查询路径时出现两个问题
依赖

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-neo4j</artifactId>
            <version>3.2.0</version>
        </dependency>
        <dependency>
            <groupId>org.neo4j</groupId>
            <artifactId>neo4j-ogm-http-driver</artifactId>
            <version>3.2.0</version>
        </dependency>

1.Resolved [org.springframework.http.converter.HttpMessageNotWritableException: Could not write JSON: Invoked method is not a property accessor]
这是查询代码

    @Query("match p = (n:Customer)-[*..5]-() with p, length(p) as l order by l desc limit 1 return p")
    Path path();

2.java.util.NoSuchElementException: null

    @Query("match p = (n:Customer)-[*..5]-() with p, length(p) as l order by l limit 1 return p")
    Path path()

但相同的语句在neo4j中能查询到值

img

  • 写回答

2条回答 默认 最新

报告相同问题?

问题事件

  • 修改了问题 1月4日
  • 创建了问题 1月4日