Skip to content
Advertisement

‘Could not extract ResultSet’ error when using nativeQuery in JPA

I’m using JPARepository in SpringBoot and using the @Query annotation but I get an error

org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet

When using the nativeQuery=true

This is my function:

Advertisement

Answer

I added the following code above my query and

@Modifying @Transactional

Like this :

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement