Author Login
Post Reply
Author: steve.ebersole@(protected)
Date: 2008-05-14 10:48:24 -0400 (Wed, 14 May 2008)
New Revision: 14663
Modified:
core/branches/Branch_3_2/test/org/hibernate/test/hql/BulkManipulationTest.java
Log:
HHH-3283 : protection on vm-based timestamps where dialect does not support params in INSERT ... SELECT
Modified: core/branches/Branch_3_2/test/org/hibernate/test/hql/BulkManipulationTest.java
===================================================================
--- core/branches/Branch_3_2/test/org/hibernate/test/hql/BulkManipulationTest.java 2008-05-14 14:48:07 UTC (rev 14662)
+++ core/branches/Branch_3_2/test/org/hibernate/test/hql/BulkManipulationTest.java 2008-05-14 14:48:24 UTC (rev 14663)
@@(protected) @@
data.cleanup();
}
+ protected boolean supportsBulkInsertIdGeneration(Class entityClass) {
+ EntityPersister persister = sfi().getEntityPersister( entityClass.getName() );
+ IdentifierGenerator generator = persister.getIdentifierGenerator();
+ return HqlSqlWalker.supportsIdGenWithBulkInsertion( generator );
+ }
+
public void testInsertWithGeneratedId() {
// Make sure the env supports bulk inserts with generated ids...
- EntityPersister persister = sfi().getEntityPersister( PettingZoo.class.getName() );
- IdentifierGenerator generator = persister.getIdentifierGenerator();
- if ( !HqlSqlWalker.supportsIdGenWithBulkInsertion( generator ) ) {
+ if ( !supportsBulkInsertIdGeneration( PettingZoo.class ) ) {
+ reportSkip( "bulk id generation not supported", "test bulk inserts with generated id and generated timestamp");
return;
}
@@(protected) @@
s.close();
assertEquals( zoo.getName(), pz.getName() );
- assertTrue( zoo.getId() != pz.getId() );
+ assertTrue( !zoo.getId().equals( pz.getId() ) );
s = openSession();
t = s.beginTransaction();
@@(protected) @@
public void testInsertWithGeneratedVersionAndId() {
// Make sure the env supports bulk inserts with generated ids...
- EntityPersister persister = sfi().getEntityPersister( IntegerVersioned.class.getName() );
- IdentifierGenerator generator = persister.getIdentifierGenerator();
- if ( !HqlSqlWalker.supportsIdGenWithBulkInsertion( generator ) ) {
+ if ( !supportsBulkInsertIdGeneration( IntegerVersioned.class ) ) {
+ reportSkip( "bulk id generation not supported", "test bulk inserts with generated id and generated timestamp");
return;
}
@@(protected) @@
public void testInsertWithGeneratedTimestampVersion() {
// Make sure the env supports bulk inserts with generated ids...
- EntityPersister persister = sfi().getEntityPersister( TimestampVersioned.class.getName() );
- IdentifierGenerator generator = persister.getIdentifierGenerator();
- if ( !HqlSqlWalker.supportsIdGenWithBulkInsertion( generator ) ) {
+ if ( !supportsBulkInsertIdGeneration( TimestampVersioned.class ) ) {
+ reportSkip( "bulk id generation not supported", "test bulk inserts with generated id and generated timestamp");
return;
}
+ // dialects which do not allow a parameter in the select portion of an INSERT ... SELECT statement
+ // will also be problematic for this test because the timestamp here is vm-based as opposed to
+ // db-based.
+ if ( !getDialect().supportsParametersInInsertSelect() ) {
+ reportSkip( "dialect does not support parameter in INSERT ... SELECT", "test bulk inserts with generated id and generated timestamp");
+ return;
+ }
Session s = openSession();
Transaction t = s.beginTransaction();
_______________________________________________
hibernate-commits mailing list
hibernate-commits@(protected)
https://lists.jboss.org/mailman/listinfo/hibernate-commits