HHH-12858 HHH-13432 fix Oracle failing tests

This commit is contained in:
Andrea Boriero 2019-10-07 10:43:30 +01:00
parent 93a07453f0
commit 1c840f9dd1
1 changed files with 39 additions and 0 deletions

View File

@ -18,13 +18,19 @@ import javax.persistence.spi.PersistenceProvider;
import javax.persistence.spi.PersistenceUnitInfo;
import javax.sql.DataSource;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.boot.spi.SessionFactoryOptions;
import org.hibernate.cache.spi.access.AccessType;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.dialect.Dialect;
import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl;
import org.hibernate.engine.jdbc.connections.internal.DriverManagerConnectionProviderImpl;
import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider;
import org.hibernate.engine.jdbc.connections.spi.JdbcConnectionAccess;
import org.hibernate.engine.jdbc.spi.JdbcServices;
import org.hibernate.engine.spi.SessionFactoryImplementor;
import org.hibernate.hql.internal.ast.HqlSqlWalker;
import org.hibernate.hql.spi.id.MultiTableBulkIdStrategy;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.hibernate.persister.entity.EntityPersister;
@ -88,6 +94,7 @@ public class PersistenceUnitOverridesTests extends BaseUnitTestCase {
final DataSource integrationDataSource = new DataSourceStub( "integrationDataSource" );
final HibernatePersistenceProvider provider = new HibernatePersistenceProvider();
puInfo.getProperties().setProperty( AvailableSettings.HQL_BULK_ID_STRATEGY, MultiTableBulkIdStrategyStub.class.getName() );
final EntityManagerFactory emf = provider.createContainerEntityManagerFactory(
puInfo,
@ -273,6 +280,7 @@ public class PersistenceUnitOverridesTests extends BaseUnitTestCase {
final Map integrationOverrides = new HashMap();
//noinspection unchecked
integrationOverrides.put( AvailableSettings.JPA_JTA_DATASOURCE, integrationDataSource );
integrationOverrides.put( AvailableSettings.HQL_BULK_ID_STRATEGY, new MultiTableBulkIdStrategyStub() );
final EntityManagerFactory emf = provider.createContainerEntityManagerFactory(
new PersistenceUnitInfoAdapter(),
@ -318,6 +326,7 @@ public class PersistenceUnitOverridesTests extends BaseUnitTestCase {
final DataSource override = new DataSourceStub( "integrationDataSource" );
final Map<String,Object> integrationSettings = new HashMap<>();
integrationSettings.put( AvailableSettings.JPA_NON_JTA_DATASOURCE, override );
integrationSettings.put( AvailableSettings.HQL_BULK_ID_STRATEGY, new MultiTableBulkIdStrategyStub() );
final PersistenceProvider provider = new HibernatePersistenceProvider();
@ -502,4 +511,34 @@ public class PersistenceUnitOverridesTests extends BaseUnitTestCase {
this.name = name;
}
}
public static class MultiTableBulkIdStrategyStub implements MultiTableBulkIdStrategy {
@Override
public void prepare(
JdbcServices jdbcServices,
JdbcConnectionAccess connectionAccess,
MetadataImplementor metadata,
SessionFactoryOptions sessionFactoryOptions) {
}
@Override
public void release(
JdbcServices jdbcServices, JdbcConnectionAccess connectionAccess) {
}
@Override
public UpdateHandler buildUpdateHandler(
SessionFactoryImplementor factory, HqlSqlWalker walker) {
return null;
}
@Override
public DeleteHandler buildDeleteHandler(
SessionFactoryImplementor factory, HqlSqlWalker walker) {
return null;
}
}
}