rajesh
04/26/2021, 10:51 AM@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
As i'm using native query with RETURNING
clause, it throws exception as
o.h.engine.jdbc.spi.SqlExceptionHelper : A result was returned when none was expected.
How should i execute this query with spring boot?iamkdblue
04/26/2021, 11:19 AMkqr
04/26/2021, 11:26 AMrajesh
04/26/2021, 11:35 AM