Hibernate version:3.1.3
Database version:Oracle 9i
I'm using version-based optimistic lock. During concurrent modifications, I get a StaleObjectException when the following property is set to false:
hibernate.jdbc.batch_versioned_data
However when it's set to true, I do not see any StaleObjectException. I examined the source code, and it seems the problem is in AbstractEntityPersister class. The following statement explains the problem:
if ( useBatch ) {
session.getBatcher().addToBatch( 1 );
return true;
}
else {
return check( update.executeUpdate(), id, j );
}
Here - the check method is doing the version check. It doesn't get called if useBatch property is true, which in turn is true when hibernate.jdbc.batch_versioned_data property is set to true. I need this property to optimize execution with batch mode - so setting it to false is not an option. What other options can I look at?
|