HHH-6872 : Test failures with hibernate.jdbc.batch_versioned_data=true

This commit is contained in:
Gail Badner 2011-12-02 02:10:15 -08:00
parent 0af7d0645d
commit af3767b82a
7 changed files with 27 additions and 6 deletions

View File

@ -40,3 +40,6 @@ hibernate.max_fetch_depth 5
hibernate.cache.region_prefix hibernate.test
hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
# NOTE: hibernate.jdbc.batch_versioned_data should be set to false when testing with Oracle
hibernate.jdbc.batch_versioned_data true

View File

@ -29,6 +29,7 @@
import org.hibernate.MappingException;
import org.hibernate.Session;
import org.hibernate.StaleObjectStateException;
import org.hibernate.StaleStateException;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
@ -55,7 +56,6 @@ public abstract class AbstractEntityWithManyToManyTest extends BaseCoreFunctiona
@Override
public void configure(Configuration cfg) {
cfg.setProperty( Environment.GENERATE_STATISTICS, "true");
cfg.setProperty( Environment.STATEMENT_BATCH_SIZE, "0" );
}
@Override
@ -934,9 +934,12 @@ public void testManyToManyCollectionOptimisticLockingWithUpdate() {
t.commit();
assertFalse( isContractVersioned );
}
catch (StaleObjectStateException ex) {
assertTrue( isContractVersioned);
catch (StaleStateException ex) {
t.rollback();
assertTrue( isContractVersioned );
if ( ! sessionFactory().getSettings().isJdbcBatchVersionedData() ) {
assertTrue( StaleObjectStateException.class.isInstance( ex ) );
}
}
s.close();

View File

@ -27,6 +27,7 @@
import org.hibernate.QueryException;
import org.hibernate.Session;
import org.hibernate.StaleObjectStateException;
import org.hibernate.StaleStateException;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.cfg.Environment;
@ -53,7 +54,6 @@ public abstract class AbstractEntityWithOneToManyTest extends BaseCoreFunctional
private boolean isContractVersioned;
public void configure(Configuration cfg) {
cfg.setProperty( Environment.GENERATE_STATISTICS, "true");
cfg.setProperty( Environment.STATEMENT_BATCH_SIZE, "0" );
}
protected boolean checkUpdateCountsAfterAddingExistingElement() {
@ -1181,9 +1181,12 @@ public void testOneToManyCollectionOptimisticLockingWithUpdate() {
t.commit();
assertFalse( isContractVersioned );
}
catch (StaleObjectStateException ex) {
assertTrue( isContractVersioned);
catch (StaleStateException ex) {
t.rollback();
assertTrue( isContractVersioned );
if ( ! sessionFactory().getSettings().isJdbcBatchVersionedData() ) {
assertTrue( StaleObjectStateException.class.isInstance( ex ) );
}
}
s.close();

View File

@ -34,3 +34,6 @@ hibernate.max_fetch_depth 5
hibernate.cache.region_prefix hibernate.test
hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
# NOTE: hibernate.jdbc.batch_versioned_data should be set to false when testing with Oracle
hibernate.jdbc.batch_versioned_data true

View File

@ -29,3 +29,6 @@ hibernate.connection.username sa
hibernate.connection.pool_size 5
hibernate.cache.region_prefix hibernate.test
# NOTE: hibernate.jdbc.batch_versioned_data should be set to false when testing with Oracle
hibernate.jdbc.batch_versioned_data true

View File

@ -36,3 +36,6 @@ hibernate.cache.region_prefix hibernate.test
hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFactory
hibernate.jdbc.batch_size 0
# NOTE: hibernate.jdbc.batch_versioned_data should be set to false when testing with Oracle
hibernate.jdbc.batch_versioned_data true

View File

@ -34,3 +34,6 @@ hibernate.format_sql true
hibernate.max_fetch_depth 5
hibernate.generate_statistics true
# NOTE: hibernate.jdbc.batch_versioned_data should be set to false when testing with Oracle
hibernate.jdbc.batch_versioned_data true