Java Spring Boot Native Query Exec Stored Proc — The statement did not return a result set
Apr 8, 2024
Adding @Modifying
and @Transactional
will help
As-is
Assume that you have repository file like this
@Query(value = "EXEC my_stored_proc;", nativeQuery = true)
void execMyStoredProc();
To-be
@Modifying
@Transactional
@Query(value = "EXEC my_stored_proc;", nativeQuery = true)
void execMyStoredProc();
Reason
The keyword @Query
is expecting that you will return the result (result set)