在我的应用程序中,我有一个与父/子关系中的自身相关的模型.帖子可以有父母也是帖子.我写了一个查询来删除目标帖子及其后代.当我在Spring之外执行查询时,它完美地运行.但是,在Spring中运行它时,查询成功执行但抛出以下异常:
WARN SqlExceptionHelper:144 - SQL Error: 0, SQLState: null
ERROR SqlExceptionHelper:146 - The statement did not return a result set.
ERROR [dispatcherServlet]:182 - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: could not extract ResultSet; nested exception is org.hibernate.exception.GenericJDBCException: could not extract ResultSet] with root cause
com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.
Run Code Online (Sandbox Code Playgroud)
我的查询从扩展JpaRepository的接口运行
@Query(value = "WITH ParentTree AS (\n" +
" SELECT Parent.post_key,\n" +
" 1 AS …Run Code Online (Sandbox Code Playgroud)