HHH-3283 : protection on vm-based timestamps where dialect does not support params in INSERT ... SELECT
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14662 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
1182ce000e
commit
fbc1988fbd
|
@ -318,11 +318,16 @@ public class BulkManipulationTest extends FunctionalTestCase {
|
||||||
data.cleanup();
|
data.cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean supportsBulkInsertIdGeneration(Class entityClass) {
|
||||||
|
EntityPersister persister = sfi().getEntityPersister( entityClass.getName() );
|
||||||
|
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
||||||
|
return HqlSqlWalker.supportsIdGenWithBulkInsertion( generator );
|
||||||
|
}
|
||||||
|
|
||||||
public void testInsertWithGeneratedId() {
|
public void testInsertWithGeneratedId() {
|
||||||
// Make sure the env supports bulk inserts with generated ids...
|
// Make sure the env supports bulk inserts with generated ids...
|
||||||
EntityPersister persister = sfi().getEntityPersister( PettingZoo.class.getName() );
|
if ( !supportsBulkInsertIdGeneration( PettingZoo.class ) ) {
|
||||||
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
reportSkip( "bulk id generation not supported", "test bulk inserts with generated id and generated timestamp");
|
||||||
if ( !HqlSqlWalker.supportsIdGenWithBulkInsertion( generator ) ) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +356,7 @@ public class BulkManipulationTest extends FunctionalTestCase {
|
||||||
s.close();
|
s.close();
|
||||||
|
|
||||||
assertEquals( zoo.getName(), pz.getName() );
|
assertEquals( zoo.getName(), pz.getName() );
|
||||||
assertTrue( zoo.getId() != pz.getId() );
|
assertTrue( !zoo.getId().equals( pz.getId() ) );
|
||||||
|
|
||||||
s = openSession();
|
s = openSession();
|
||||||
t = s.beginTransaction();
|
t = s.beginTransaction();
|
||||||
|
@ -362,9 +367,8 @@ public class BulkManipulationTest extends FunctionalTestCase {
|
||||||
|
|
||||||
public void testInsertWithGeneratedVersionAndId() {
|
public void testInsertWithGeneratedVersionAndId() {
|
||||||
// Make sure the env supports bulk inserts with generated ids...
|
// Make sure the env supports bulk inserts with generated ids...
|
||||||
EntityPersister persister = sfi().getEntityPersister( IntegerVersioned.class.getName() );
|
if ( !supportsBulkInsertIdGeneration( IntegerVersioned.class ) ) {
|
||||||
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
reportSkip( "bulk id generation not supported", "test bulk inserts with generated id and generated timestamp");
|
||||||
if ( !HqlSqlWalker.supportsIdGenWithBulkInsertion( generator ) ) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,9 +411,15 @@ public class BulkManipulationTest extends FunctionalTestCase {
|
||||||
|
|
||||||
public void testInsertWithGeneratedTimestampVersion() {
|
public void testInsertWithGeneratedTimestampVersion() {
|
||||||
// Make sure the env supports bulk inserts with generated ids...
|
// Make sure the env supports bulk inserts with generated ids...
|
||||||
EntityPersister persister = sfi().getEntityPersister( TimestampVersioned.class.getName() );
|
if ( !supportsBulkInsertIdGeneration( TimestampVersioned.class ) ) {
|
||||||
IdentifierGenerator generator = persister.getIdentifierGenerator();
|
reportSkip( "bulk id generation not supported", "test bulk inserts with generated id and generated timestamp");
|
||||||
if ( !HqlSqlWalker.supportsIdGenWithBulkInsertion( generator ) ) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue