0

I have recently installed oracle server 12c and deployed Java Spring-Hibernate application.

While I am doing a TRUNCATE commands from SqlDeveloper tool and sending commit command, the data is not reflected in Java application.

Only after a restart of the application, the data updated from SqlDeveloper is reflected. One solution suggested was to turn on the Auto Commit by using SQL> SET AUTOCOMMIT ON;, which I have done. But the issue persists.

Important to note, only TUNCATE TABLE command is not reflected, i.e. java application still finds data in the table which TRUNCATE'ed from SQLDeveloper, Insert/Update commands are getting reflected.

I am sending commit command both ways, by using Commit button from SqlDeveloper menu and by using commit; on SQL worksheet.

The same Java application (Without any changes in Configuration) is identifying the empty table (TRUNCATE'ed from SqlDeveloper) on another instance of Oracle 12C Server.

So, I suspect the issue is with the oracle server configuration.

Gunwant
  • 949
  • 1
  • 14
  • 29
  • 2
    If the fix is to restart *your* Java application, why do you believe that SqlDeveloper is the culprit? It is far more likely that it is your Java application that is flawed, e.g. forgetting to call `commit()` or `rollback()`, and is stuck on some earlier snapshot. – Andreas Jan 30 '20 at 07:19
  • @Andreas , I do not think so, Same application code works well with other database (I do not won that server, but I can connect), SQLDeveloper commits also gets reflected on that Database server. – Gunwant Jan 30 '20 at 07:23
  • *"works well with other database"* Do you mean another Oracle Database instance, or some other non-Oracle database? Because Oracle is fairly unique in having Read-Committed transactions using a snapshot taken at the start of the transaction. None of the other vendors do that, at least not by default. So non-Oracle database will show new data, even in an on-going transaction. – Andreas Jan 30 '20 at 07:26
  • Another Oracle 12C Databse Instance – Gunwant Jan 30 '20 at 07:27
  • @Andreas Question statement updated, only TRUNCATE statement used from SqlDeveloper is not reflected to Java application, Java application still finds Data in the TRUNCATE'ed table. – Gunwant Jan 30 '20 at 09:06
  • Do you use any cache in your application? – Simon Martinelli Jan 30 '20 at 09:26
  • @SimonMartinelli No cache, just Hibernate – Gunwant Jan 30 '20 at 09:50
  • 1
    Hibernate has a cache too.how do you read the data with Hibernate? – Simon Martinelli Jan 30 '20 at 09:57
  • there must be a cache, use sqldeveloper to create a 2nd connection to the same data to see if your transactions have been committed - or use SQLcl or SQLPlus – thatjeffsmith Jan 30 '20 at 13:18
  • 1
    Possible duplicate of [Clear Hibernate 2nd level cache after manually DB update](https://stackoverflow.com/q/40302097/5221149) – Andreas Jan 30 '20 at 14:04

0 Answers0