Reputation: 195
I am getting this error every time I try to hit one of my POST endpoints in my spring app that simply calls 1 of these 3 JPA save methods:
save()
saveAll()
saveAndFlush()
org.springframework.dao.InvalidDataAccessResourceUsageException: could not extract ResultSet; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not extract ResultSet .... Caused by: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist .... Caused by: oracle.jdbc.OracleDatabaseException: ORA-00942: table or view does not exist
A few things I want to first clarify:
The only thing that I have found that relates to this specific JPA save issue is this article where it mentions that
Hibernate, PostgreSQL : Could not extract resultset, SQLState , Your actual problem is simple: you called a save() operation in a read-only transaction. But, because you swallow your exceptions with: } <pgsql-jdbc(at)postgresql(dot)org> Subject: Re: Update ResultSet: Date: to extract the name of the table to update or throw an "ResultSet is not updateable
I have no idea where to start on trying to solve this error. These are the versions of related dependent code, although I have also played with these without any luck.
org.hibernate:hibernate-core 5.4.30.Final (tried 5.4.21.Final)
org.hibernate.common:hibernate-commons-annotations 5.1.2.Final (tried 5.1.0.Final)
org.springframework.data:spring-data-jpa 2.4.8 (tried 2.3.4.Release)
I am also using this as my property which does successfully validate my DB schema otherwise the service would fail on start up. I have seen people say to use "update" but, that didnt help and should not be the solution.
spring.jpa.hibernate.ddl-auto=validate
Any help is appreciated. I don't think it is a code problem but, at the same time I cannot find anything on the oracle DB side that seems out of the ordinary.
Upvotes: 1
Views: 7057
Reputation: 11
just use update query of hibernate in properties files
spring.jpa.hibernate.ddl-auto=update
It will refresh and update your database
I have same problem but resolved by this,it was working in spring boot
Upvotes: 1
Reputation: 195
SOLUTION:
After enabling
spring.jpa.show-sql=true
I realized that this was the first line of sql it was executing before crashing.
Hibernate: select hibernate_sequence.nextval from dual
The reason, every JPA save operation utilized this sequence was because I am using a @GeneratedValue(strategy = GenerationType.AUTO) on my @Id for my tables. To resolve, I simply executed grant permissions to the non_owner_acct to that SEQUENCE.
GRANT SELECT ON "SCHEMA"."HIBERNATE_SEQUENCE" TO "NON_OWNER_ACCT";
Upvotes: 1
Reputation: 81
some thoughts that came to my mind:
Upvotes: 1