Author: steve.ebersole(a)jboss.com
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)
@@ -318,11 +318,16 @@
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;
}
@@ -351,7 +356,7 @@
s.close();
assertEquals( zoo.getName(), pz.getName() );
- assertTrue( zoo.getId() != pz.getId() );
+ assertTrue( !zoo.getId().equals( pz.getId() ) );
s = openSession();
t = s.beginTransaction();
@@ -362,9 +367,8 @@
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;
}
@@ -407,11 +411,17 @@
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();
Show replies by thread