HHH-5200 - Prepare to use H2 as the default testing datbase
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@19429 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
413666f293
commit
b4fa90a58b
|
@ -114,8 +114,18 @@ public class SettingsFactory implements Serializable {
|
|||
Connection conn = connections.getConnection();
|
||||
try {
|
||||
DatabaseMetaData meta = conn.getMetaData();
|
||||
log.info( "RDBMS: " + meta.getDatabaseProductName() + ", version: " + meta.getDatabaseProductVersion() );
|
||||
log.info( "JDBC driver: " + meta.getDriverName() + ", version: " + meta.getDriverVersion() );
|
||||
log.info( "Database ->\n" +
|
||||
" name : " + meta.getDatabaseProductName() + '\n' +
|
||||
" version : " + meta.getDatabaseProductVersion() + '\n' +
|
||||
" major : " + meta.getDatabaseMajorVersion() + '\n' +
|
||||
" minor : " + meta.getDatabaseMinorVersion()
|
||||
);
|
||||
log.info( "Driver ->\n" +
|
||||
" name : " + meta.getDriverName() + '\n' +
|
||||
" version : " + meta.getDriverVersion() + '\n' +
|
||||
" major : " + meta.getDriverMajorVersion() + '\n' +
|
||||
" minor : " + meta.getDriverMinorVersion()
|
||||
);
|
||||
|
||||
dialect = DialectFactory.buildDialect( props, conn );
|
||||
jdbcSupport = JdbcSupportLoader.loadJdbcSupport( conn );
|
||||
|
|
|
@ -592,7 +592,7 @@
|
|||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>1.2.124</version>
|
||||
<version>1.2.134</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
|
|
|
@ -185,12 +185,14 @@ public class WithClauseTest extends FunctionalTestCase {
|
|||
public void cleanup() {
|
||||
Session session = openSession();
|
||||
Transaction txn = session.beginTransaction();
|
||||
session.createQuery( "delete Animal where mother is not null" ).executeUpdate();
|
||||
List humansWithFriends = session.createQuery( "from Human h where exists(from h.friends)" ).list();
|
||||
Iterator itr = humansWithFriends.iterator();
|
||||
while ( itr.hasNext() ) {
|
||||
session.delete( itr.next() );
|
||||
}
|
||||
Human father = (Human) session.createQuery( "from Human where description = 'father'" ).uniqueResult();
|
||||
father.getFriends().clear();
|
||||
session.flush();
|
||||
session.delete( session.createQuery( "from Human where description = 'friend'" ).uniqueResult() );
|
||||
session.delete( session.createQuery( "from Human where description = 'child1'" ).uniqueResult() );
|
||||
session.delete( session.createQuery( "from Human where description = 'child2'" ).uniqueResult() );
|
||||
session.delete( session.createQuery( "from Human where description = 'mother'" ).uniqueResult() );
|
||||
session.delete( father );
|
||||
session.createQuery( "delete Animal" ).executeUpdate();
|
||||
txn.commit();
|
||||
session.close();
|
||||
|
|
|
@ -74,7 +74,7 @@ public class JPALockTest extends AbstractJPATest {
|
|||
|
||||
Long itemId = item.getId();
|
||||
|
||||
// doAfterTransactionCompletion the isolated update
|
||||
// do the isolated update
|
||||
s1 = getSessions().openSession();
|
||||
t1 = s1.beginTransaction();
|
||||
item = (Item) s1.get( Item.class, itemId );
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
import junit.framework.Test;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.id.PostInsertIdentifierGenerator;
|
||||
import org.hibernate.junit.functional.FunctionalTestClassTestSuite;
|
||||
import org.hibernate.classic.Session;
|
||||
import org.hibernate.dialect.HSQLDialect;
|
||||
|
@ -31,10 +32,15 @@ public class CustomSQLTest extends LegacyTestCase {
|
|||
return new FunctionalTestClassTestSuite( CustomSQLTest.class );
|
||||
}
|
||||
|
||||
public void testInsert() throws HibernateException, SQLException {
|
||||
private boolean isUsingIdentity() {
|
||||
return PostInsertIdentifierGenerator.class.isAssignableFrom( getDialect().getNativeIdentifierGeneratorClass() );
|
||||
}
|
||||
|
||||
if ( getDialect() instanceof HSQLDialect ) return;
|
||||
if ( getDialect() instanceof MySQLDialect ) return;
|
||||
public void testInsert() throws HibernateException, SQLException {
|
||||
if ( isUsingIdentity() ) {
|
||||
reportSkip( "hand sql expecting non-identity id gen", "Custom SQL" );
|
||||
return;
|
||||
}
|
||||
|
||||
Role p = new Role();
|
||||
|
||||
|
@ -93,9 +99,10 @@ public class CustomSQLTest extends LegacyTestCase {
|
|||
}
|
||||
|
||||
public void testCollectionCUD() throws HibernateException, SQLException {
|
||||
|
||||
if ( getDialect() instanceof HSQLDialect ) return;
|
||||
if ( getDialect() instanceof MySQLDialect ) return;
|
||||
if ( isUsingIdentity() ) {
|
||||
reportSkip( "hand sql expecting non-identity id gen", "Custom SQL" );
|
||||
return;
|
||||
}
|
||||
|
||||
Role role = new Role();
|
||||
|
||||
|
@ -155,9 +162,10 @@ public class CustomSQLTest extends LegacyTestCase {
|
|||
}
|
||||
|
||||
public void testCRUD() throws HibernateException, SQLException {
|
||||
|
||||
if ( getDialect() instanceof HSQLDialect ) return;
|
||||
if ( getDialect() instanceof MySQLDialect ) return;
|
||||
if ( isUsingIdentity() ) {
|
||||
reportSkip( "hand sql expecting non-identity id gen", "Custom SQL" );
|
||||
return;
|
||||
}
|
||||
|
||||
Person p = new Person();
|
||||
|
||||
|
@ -206,7 +214,5 @@ public class CustomSQLTest extends LegacyTestCase {
|
|||
|
||||
s.connection().commit();
|
||||
s.close();
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue