我使用postgresql和springdatajpa执行更新,如下所示
@Transactional
@Modifying(flushAutomatically = true, clearAutomatically = true)
@Query(
"UPDATE posts SET comments_count = comments_count +1 WHERE post_id = :postId RETURNING comments_count",
nativeQuery = true
)
fun incrementCommentCounter(@Param("postId") postId: Long): Int
当我使用本机查询时 RETURNING
子句,它抛出异常
o.h.engine.jdbc.spi.SqlExceptionHelper : A result was returned when none was expected.
我应该如何用spring boot执行这个查询?
暂无答案!
目前还没有任何答案,快来回答吧!