HHH-11308 - Bump C3P0 version up to support JDBC 4.2

This commit is contained in:
Vlad Mihalcea 2016-12-06 14:44:40 +02:00
parent ab9016306b
commit 4dea338fb6
2 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,65 @@
/*
* Hibernate, Relational Persistence for Idiomatic Java
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
*/
package org.hibernate.test.c3p0;
import java.sql.Statement;
import org.hibernate.dialect.SQLServer2005Dialect;
import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* Tests that checks the JDBC 4.2 compatibility of c3p0
*
* @author Vlad Mihalcea
*/
@RequiresDialect(SQLServer2005Dialect.class)
public class JdbcCompatibilityTest extends BaseCoreFunctionalTestCase {
@Test
@TestForIssue( jiraKey = "HHH-11308" )
public void testJdbc41() {
doInHibernate( this::sessionFactory, session -> {
session.doWork( connection -> {
//Connection#getSchema was added in Java 1.7
String schema = connection.getSchema();
assertNotNull(schema);
} );
} );
}
@Test
@TestForIssue( jiraKey = "HHH-11308" )
public void testJdbc42() {
doInHibernate( this::sessionFactory, session -> {
for ( int i = 0; i < 5; i++ ) {
IrrelevantEntity entity = new IrrelevantEntity();
entity.setName( getClass().getName() );
session.persist( entity );
}
session.flush();
session.doWork( connection -> {
try( Statement statement = connection.createStatement()) {
statement.executeUpdate( "DELETE FROM IrrelevantEntity" );
assertEquals( 5, statement.getLargeUpdateCount());
}
} );
} );
}
@Override
protected Class<?>[] getAnnotatedClasses() {
return new Class[]{ IrrelevantEntity.class };
}
}

View File

@ -122,7 +122,7 @@ ext {
jnp_client: "org.jboss.naming:jnp-client:${jnpVersion}",
jnp_server: "org.jboss.naming:jnpserver:${jnpVersion}",
c3p0: "com.mchange:c3p0:0.9.2.1",
c3p0: "com.mchange:c3p0:0.9.5.2",
ehcache: "net.sf.ehcache:ehcache:2.10.3",
ehcache3: "org.ehcache:ehcache:3.0.0",
jcache: "javax.cache:cache-api:1.0.0",