Hibernate version: 2.1.6
I've been using optimistic concurrency control with separate sessions and automatic versioning (as per ref 10.4.2). When there is a version mis-match, I catch StaleObjectStateException and take the appropriate action in my application. So far so good.
If I set hibernate.jdbc.batch_versioned_data to true in hibernate.properties, I no longer get a StaleObjectStateException, but a plain HibernateException. It comes from net.sf.hibernate.impl.NonBatchingBatcher.addToBatch(). The code correctly checks the row count returned from the SQL UPDATE, but doesn't throw the expected StaleObjectStateException on a failure. This means I am unable to handle this expected concurrency error in my application.
The obvious work around is to set batch_versioned_data to false. However, my database (PostgreSQL 7.4) is correctly returning a row count of 0, not the broken -2 that JDBC allows, so it would be nice to be able to set it to true (and presumably get a minor speed up?).
Chris.
|