Open Dennis3453 opened 3 years ago
By "use MYSCHEMA as default schema" you mean the NamingStrategy
you showed, right?
I can't see the mistake in the insert statement. Can you connect to the database with the user readonlyuser
and find out how such insert statement should look?
Also showing the SELECT statements that do work might help.
The insert statement from log is correct and can be executed in Oracle SQL developer.
Same statement also work with @Query
.
@Modifying
@Query("INSERT INTO \"MYSCHEMA\".\"CUSTOMER\" (\"CUSTOMER_ID\", \"NAME\") VALUES (1, 'TEST')")
boolean insert();
[nio-9091-exec-1] o.s.jdbc.core.JdbcTemplate : Executing prepared SQL update
[nio-9091-exec-1] o.s.jdbc.core.JdbcTemplate : Executing prepared SQL statement [INSERT INTO "MYSCHEMA"."CUSTOMER" ("CUSTOMER_ID", "NAME") VALUES (1, 'TEST')]
SELECT statement
repo.findAll();
[nio-9091-exec-2] o.s.jdbc.core.JdbcTemplate : Executing prepared SQL query
[nio-9091-exec-2] o.s.jdbc.core.JdbcTemplate : Executing prepared SQL statement [SELECT "MYSCHEMA"."CUSTOMER"."CUSTOMER_ID" AS "CUSTOMER_ID", "MYSCHEMA"."CUSTOMER"."NAME" AS "NAME" FROM "MYSCHEMA"."CUSTOMER"]
That is ... interesting. I'll need a reproducer to understand what is going on here.
Please try this. Thanks. https://github.com/Dennis3453/my-oracle-svc
I can't access that reproducer. Also the github user doesn't have any public repositories. Is it private maybe?
Already set back to public, is that I can try with this?
Yes, that should work.
I looked at the reproducer and it contains a lot of cruft (vaading, Hibernate, Spring web). Please simplify the reproducer.
Also it requires a database setup that is only described in prose with multiple users. Please provide at very least a complete script that based on a single user, creates the separate schema. Or even better, use Testcontainers to setup the database.
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
When I try to connect Oracle with username readonlyuser, and use MYSCHEMA as default schema, findAll() and findById() are working but all repo.save() failed to work and return error "object "MYSCHEMA" does not exist".
Spring Boot version: 2.5.2 & 2.5.4