Hibernate version: 3.2.6ga
Full stack trace of any exception that occurs: a StaleObjectStateException is thrown when Oracle style batch updates is enabled (I still don't know why).
Name and version of the database you are using: Oracle 11g
The generated SQL (show_sql=true): Update statement
Actually, this exception appeared when I enabled the Oracle style batch updates without reading the "Note" part.
Quote:
Oracle JDBC supports two distinct models for update batching:
* The standard model, implementing the JDBC 2.0 specification, which is referred to as standard update batching
* The Oracle-specific model, independent of the JDBC 2.0 specification, which is referred to as Oracle update batching
Note:
It is important to be aware that you cannot mix these models. In any single application, you can use one model or the other, but not both. Oracle JDBC driver will throw exceptions when you mix these.
This was in the note when Turning Performance on Oracle JDBC OCI Drivers. Hibernate uses the pure JDBC style batch updates:
Code:
Statement.addBatch()
But Oracle JDBC OCI driver is different. My only reason why I enabled the Oracle style batch updates is the performance since my application will not be deployed with the Oracle server.
I hope the Hibernate developers can investigate on this matter.