From 4b26cb5876351c3dcf79222e39004e4e25af17e8 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Sun, 23 Jan 2022 10:46:40 +0100 Subject: [PATCH] remove use of deprecated accessors of SessionFactoryImplementor --- .../internal/ThreadLocalSessionContext.java | 2 +- .../java/org/hibernate/dialect/Dialect.java | 13 +++---- .../PessimisticReadUpdateLockingStrategy.java | 2 +- ...PessimisticWriteUpdateLockingStrategy.java | 2 +- .../dialect/lock/UpdateLockingStrategy.java | 2 +- .../engine/internal/ForeignKeys.java | 2 +- .../batch/internal/AbstractBatchImpl.java | 2 +- .../jdbc/batch/internal/NonBatchingBatch.java | 2 +- .../jdbc/internal/JdbcCoordinatorImpl.java | 4 +-- .../jdbc/internal/ResultSetReturnImpl.java | 2 +- .../jdbc/internal/StatementPreparerImpl.java | 4 +-- .../engine/jdbc/spi/JdbcCoordinator.java | 2 -- .../spi/SessionFactoryDelegatingImpl.java | 34 +++++++++--------- .../engine/spi/SessionFactoryImplementor.java | 1 - .../internal/DefaultDeleteEventListener.java | 2 +- .../AbstractSharedSessionContract.java | 2 +- .../internal/FastSessionServices.java | 2 +- .../AbstractCollectionPersister.java | 22 ++++++------ .../collection/OneToManyPersister.java | 10 +++--- .../entity/AbstractEntityPersister.java | 2 +- .../entity/JoinedSubclassEntityPersister.java | 4 +-- .../entity/UnionSubclassEntityPersister.java | 1 - .../stat/internal/StatisticsInitiator.java | 6 ++-- .../dataTypes/BasicOperationsTest.java | 4 +-- .../annotations/query/QueryAndSQLTest.java | 6 ++-- .../hibernate/orm/test/batch/BatchTest.java | 8 ++--- .../exception/SQLExceptionConversionTest.java | 2 +- ...HiloGeneratorWitZeroIncrementSizeTest.java | 4 +-- .../orm/test/jdbc/GeneralWorkTest.java | 4 +-- .../jdbc/internal/AggressiveReleaseTest.java | 2 +- .../jdbc/internal/BasicConnectionTest.java | 4 +-- .../orm/test/jdbc/internal/BatchingTest.java | 36 +++++++++---------- .../hibernate/orm/test/mixed/MixedTest.java | 2 +- .../hibernate/orm/test/rowid/RowIdTest2.java | 2 +- .../SessionWithSharedConnectionTest.java | 5 ++- .../sql/autodiscovery/AutoDiscoveryTest.java | 5 ++- .../orm/test/temporal/TimePropertyTest.java | 2 +- .../ResultTransformerTest.java | 2 +- 38 files changed, 102 insertions(+), 111 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java b/hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java index 508503e68a..f124f2c93d 100644 --- a/hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java +++ b/hibernate-core/src/main/java/org/hibernate/context/internal/ThreadLocalSessionContext.java @@ -172,7 +172,7 @@ public class ThreadLocalSessionContext extends AbstractCurrentSessionContext { * @return The connection release mode for any built sessions. */ protected ConnectionReleaseMode getConnectionReleaseMode() { - return factory().getSettings().getConnectionReleaseMode(); + return factory().getSessionFactoryOptions().getPhysicalConnectionHandlingMode().getReleaseMode(); } protected Session wrap(Session session) { diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java index 3d16af8286..fbb09ed286 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/Dialect.java @@ -1518,7 +1518,8 @@ public abstract class Dialect implements ConversionContext { return target; } catch (SQLException e ) { - throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge BLOB data" ); + throw session.getFactory().getJdbcServices().getSqlExceptionHelper() + .convert( e, "unable to merge BLOB data" ); } } else { @@ -1538,7 +1539,7 @@ public abstract class Dialect implements ConversionContext { return target; } catch (SQLException e ) { - throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge CLOB data" ); + throw session.getFactory().getJdbcServices().getSqlExceptionHelper().convert( e, "unable to merge CLOB data" ); } } else { @@ -1558,7 +1559,7 @@ public abstract class Dialect implements ConversionContext { return target; } catch (SQLException e ) { - throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge NCLOB data" ); + throw session.getFactory().getJdbcServices().getSqlExceptionHelper().convert( e, "unable to merge NCLOB data" ); } } else { @@ -1585,7 +1586,7 @@ public abstract class Dialect implements ConversionContext { : lobCreator.createBlob( original.getBinaryStream(), original.length() ); } catch (SQLException e) { - throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge BLOB data" ); + throw session.getFactory().getJdbcServices().getSqlExceptionHelper().convert( e, "unable to merge BLOB data" ); } } @@ -1601,7 +1602,7 @@ public abstract class Dialect implements ConversionContext { : lobCreator.createClob( original.getCharacterStream(), original.length() ); } catch (SQLException e) { - throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge CLOB data" ); + throw session.getFactory().getJdbcServices().getSqlExceptionHelper().convert( e, "unable to merge CLOB data" ); } } @@ -1617,7 +1618,7 @@ public abstract class Dialect implements ConversionContext { : lobCreator.createNClob( original.getCharacterStream(), original.length() ); } catch (SQLException e) { - throw session.getFactory().getSQLExceptionHelper().convert( e, "unable to merge NCLOB data" ); + throw session.getFactory().getJdbcServices().getSqlExceptionHelper().convert( e, "unable to merge NCLOB data" ); } } }; diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticReadUpdateLockingStrategy.java b/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticReadUpdateLockingStrategy.java index 8c9e6f4aa4..f67f056854 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticReadUpdateLockingStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticReadUpdateLockingStrategy.java @@ -121,7 +121,7 @@ public class PessimisticReadUpdateLockingStrategy implements LockingStrategy { protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); - final Update update = new Update( factory.getDialect() ); + final Update update = new Update( factory.getJdbcServices().getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteUpdateLockingStrategy.java b/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteUpdateLockingStrategy.java index 533d7f5de2..a622acdafa 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteUpdateLockingStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/lock/PessimisticWriteUpdateLockingStrategy.java @@ -119,7 +119,7 @@ public class PessimisticWriteUpdateLockingStrategy implements LockingStrategy { protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); - final Update update = new Update( factory.getDialect() ); + final Update update = new Update( factory.getJdbcServices().getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java b/hibernate-core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java index 0cce1ce2cc..c3b51f829a 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/lock/UpdateLockingStrategy.java @@ -123,7 +123,7 @@ public class UpdateLockingStrategy implements LockingStrategy { protected String generateLockString() { final SessionFactoryImplementor factory = lockable.getFactory(); - final Update update = new Update( factory.getDialect() ); + final Update update = new Update( factory.getJdbcServices().getDialect() ); update.setTableName( lockable.getRootTableName() ); update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() ); update.setVersionColumnName( lockable.getVersionColumnName() ); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/internal/ForeignKeys.java b/hibernate-core/src/main/java/org/hibernate/engine/internal/ForeignKeys.java index 7baf582b4a..4f851e2f17 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/internal/ForeignKeys.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/internal/ForeignKeys.java @@ -214,7 +214,7 @@ public final class ForeignKeys { // case we definitely need to nullify if ( object == self ) { return isEarlyInsert - || ( isDelete && session.getFactory().getDialect().hasSelfReferentialForeignKeyBug() ); + || ( isDelete && session.getFactory().getJdbcServices().getDialect().hasSelfReferentialForeignKeyBug() ); } // See if the entity is already bound to this session, if not look at the diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/AbstractBatchImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/AbstractBatchImpl.java index 5abbdc40f1..d749b0f927 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/AbstractBatchImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/AbstractBatchImpl.java @@ -154,7 +154,7 @@ public abstract class AbstractBatchImpl implements Batch { protected void releaseStatements() { final LinkedHashMap statements = getStatements(); - final ResourceRegistry resourceRegistry = jdbcCoordinator.getResourceRegistry(); + final ResourceRegistry resourceRegistry = jdbcCoordinator.getLogicalConnection().getResourceRegistry(); for ( PreparedStatement statement : statements.values() ) { clearBatch( statement ); resourceRegistry.release( statement ); diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/NonBatchingBatch.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/NonBatchingBatch.java index 224866b295..9b290befa9 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/NonBatchingBatch.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/batch/internal/NonBatchingBatch.java @@ -45,7 +45,7 @@ public class NonBatchingBatch extends AbstractBatchImpl { final PreparedStatement statement = entry.getValue(); final int rowCount = jdbcCoordinator.getResultSetReturn().executeUpdate( statement ); getKey().getExpectation().verifyOutcome( rowCount, statement, 0, statementSQL ); - jdbcCoordinator.getResourceRegistry().release( statement ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( statement ); jdbcCoordinator.afterStatementExecution(); } catch ( SQLException e ) { diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java index 44156e403d..0984368429 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/JdbcCoordinatorImpl.java @@ -274,11 +274,11 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator { } private void releaseResources() { - getResourceRegistry().releaseResources(); + getLogicalConnection().getResourceRegistry().releaseResources(); } private boolean hasRegisteredResources() { - return getResourceRegistry().hasRegisteredResources(); + return getLogicalConnection().getResourceRegistry().hasRegisteredResources(); } private ConnectionReleaseMode determineConnectionReleaseMode( diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/ResultSetReturnImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/ResultSetReturnImpl.java index e3b64b3f7a..2394ba014d 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/ResultSetReturnImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/ResultSetReturnImpl.java @@ -227,7 +227,7 @@ public class ResultSetReturnImpl implements ResultSetReturn { private void postExtract(ResultSet rs, Statement st) { if ( rs != null ) { - jdbcCoordinator.getResourceRegistry().register( rs, st ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().register( rs, st ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java index 2bbbe6da0a..69061dcd70 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/internal/StatementPreparerImpl.java @@ -62,7 +62,7 @@ class StatementPreparerImpl implements StatementPreparer { public Statement createStatement() { try { final Statement statement = connection().createStatement(); - jdbcCoordinator.getResourceRegistry().register( statement, true ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().register( statement, true ); return statement; } catch ( SQLException e ) { @@ -190,7 +190,7 @@ class StatementPreparerImpl implements StatementPreparer { protected abstract PreparedStatement doPrepare() throws SQLException; public void postProcess(PreparedStatement preparedStatement) throws SQLException { - jdbcCoordinator.getResourceRegistry().register( preparedStatement, true ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().register( preparedStatement, true ); // logicalConnection().notifyObserversStatementPrepared(); } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcCoordinator.java b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcCoordinator.java index 2b9c4e39ea..c4b99eae16 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcCoordinator.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/jdbc/spi/JdbcCoordinator.java @@ -12,13 +12,11 @@ import java.io.Serializable; import java.sql.Connection; import java.sql.Statement; -import org.hibernate.ConnectionReleaseMode; import org.hibernate.engine.jdbc.batch.spi.Batch; import org.hibernate.engine.jdbc.batch.spi.BatchKey; import org.hibernate.jdbc.WorkExecutorVisitable; import org.hibernate.resource.jdbc.ResourceRegistry; import org.hibernate.resource.jdbc.spi.LogicalConnectionImplementor; -import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; import org.hibernate.resource.transaction.backend.jdbc.spi.JdbcResourceTransactionAccess; import org.hibernate.resource.transaction.spi.TransactionCoordinatorOwner; diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryDelegatingImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryDelegatingImpl.java index c15254a6e3..063efe1f7e 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryDelegatingImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryDelegatingImpl.java @@ -202,22 +202,22 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, return delegate.getProperties(); } - @Override + @Override @Deprecated public EntityPersister getEntityPersister(String entityName) throws MappingException { return delegate.getEntityPersister( entityName ); } - @Override + @Override @Deprecated public Map getEntityPersisters() { return delegate.getEntityPersisters(); } - @Override + @Override @Deprecated public CollectionPersister getCollectionPersister(String role) throws MappingException { return delegate.getCollectionPersister( role ); } - @Override + @Override @Deprecated public Map getCollectionPersisters() { return delegate.getCollectionPersisters(); } @@ -232,17 +232,17 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, return delegate.getSqlStringGenerationContext(); } - @Override + @Override @Deprecated public Dialect getDialect() { - return delegate.getDialect(); + return delegate.getJdbcServices().getDialect(); } - @Override + @Override @Deprecated public String[] getImplementors(String className) throws MappingException { return delegate.getImplementors( className ); } - @Override + @Override @Deprecated public String getImportedClassName(String name) { return delegate.getImportedClassName( name ); } @@ -257,22 +257,22 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, return delegate.bestGuessEntityName( object ); } - @Override + @Override @Deprecated public StatisticsImplementor getStatisticsImplementor() { return delegate.getStatistics(); } - @Override + @Override @Deprecated public SQLExceptionConverter getSQLExceptionConverter() { return delegate.getSQLExceptionConverter(); } - @Override + @Override @Deprecated public SqlExceptionHelper getSQLExceptionHelper() { - return delegate.getSQLExceptionHelper(); + return delegate.getJdbcServices().getSqlExceptionHelper(); } - @Override + @Override @Deprecated public Settings getSettings() { return delegate.getSettings(); } @@ -282,7 +282,7 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, return delegate.openTemporarySession(); } - @Override + @Override @Deprecated public Set getCollectionRolesByEntityParticipant(String entityName) { return delegate.getCollectionRolesByEntityParticipant( entityName ); } @@ -327,7 +327,7 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, return delegate.getCurrentTenantIdentifierResolver(); } - @Override + @Override @Deprecated public Iterable iterateEntityNameResolvers() { return delegate.iterateEntityNameResolvers(); } @@ -337,12 +337,12 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor, return delegate.getFastSessionServices(); } - @Override + @Override @Deprecated public EntityPersister locateEntityPersister(Class byClass) { return delegate.locateEntityPersister( byClass ); } - @Override + @Override @Deprecated public EntityPersister locateEntityPersister(String byName) { return delegate.locateEntityPersister( byName ); } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java index 7a3bdec297..ff80807c07 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionFactoryImplementor.java @@ -240,7 +240,6 @@ public interface SessionFactoryImplementor * @deprecated since 5.0; use {@link #getSessionFactoryOptions()} instead */ @Deprecated - @SuppressWarnings("deprecation") Settings getSettings(); diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultDeleteEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultDeleteEventListener.java index e0b0c128af..9ec9d74a2a 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultDeleteEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultDeleteEventListener.java @@ -157,7 +157,7 @@ public class DefaultDeleteEventListener implements DeleteEventListener, Callback transientEntities ); - if ( source.getFactory().getSettings().isIdentifierRollbackEnabled() ) { + if ( source.getFactory().getSessionFactoryOptions().isIdentifierRollbackEnabled() ) { persister.resetIdentifier( entity, id, version, source ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java index 7ede31eb5f..a185709f60 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java @@ -163,7 +163,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont this.flushMode = options.getInitialSessionFlushMode(); this.tenantIdentifier = options.getTenantIdentifier(); - if ( factory.getSettings().isMultiTenancyEnabled() && tenantIdentifier == null ) { + if ( factory.getSessionFactoryOptions().isMultiTenancyEnabled() && tenantIdentifier == null ) { throw new HibernateException( "SessionFactory configured for multi-tenancy, but no tenant identifier specified" ); } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java b/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java index 16594f4d02..013732dba4 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/FastSessionServices.java @@ -222,7 +222,7 @@ public final class FastSessionServices { this.preferredSqlTypeCodeForBoolean = sessionFactoryOptions.getPreferredSqlTypeCodeForBoolean(); this.defaultTimeZoneStorageStrategy = sessionFactoryOptions.getDefaultTimeZoneStorageStrategy(); this.defaultJdbcBatchSize = sessionFactoryOptions.getJdbcBatchSize(); - this.requiresMultiTenantConnectionProvider = sf.getSettings().isMultiTenancyEnabled(); + this.requiresMultiTenantConnectionProvider = sf.getSessionFactoryOptions().isMultiTenancyEnabled(); //Some "hot" services: this.connectionProvider = requiresMultiTenantConnectionProvider ? null : sr.getService( ConnectionProvider.class ); diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java index 7d222cee0c..86064eefc6 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/AbstractCollectionPersister.java @@ -301,8 +301,8 @@ public abstract class AbstractCollectionPersister cacheEntryStructure = UnstructuredCacheEntry.INSTANCE; } - dialect = factory.getDialect(); - sqlExceptionHelper = factory.getSQLExceptionHelper(); + dialect = factory.getJdbcServices().getDialect(); + sqlExceptionHelper = factory.getJdbcServices().getSqlExceptionHelper(); collectionType = collectionBootDescriptor.getCollectionType(); navigableRole = new NavigableRole( collectionBootDescriptor.getRole() ); entityName = collectionBootDescriptor.getOwnerEntityName(); @@ -522,7 +522,7 @@ public abstract class AbstractCollectionPersister identifierColumnAlias = col.getAlias( dialect ); identifierGenerator = idColl.getIdentifier().createIdentifierGenerator( persisterCreationContext.getBootstrapContext().getIdentifierGeneratorFactory(), - factory.getDialect(), + factory.getJdbcServices().getDialect(), null ); identifierGenerator.initialize( creationContext.getSessionFactory().getSqlStringGenerationContext() ); @@ -1435,7 +1435,7 @@ public abstract class AbstractCollectionPersister } finally { if ( !useBatch ) { - session.getJdbcCoordinator().getResourceRegistry().release( st ); + session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); session.getJdbcCoordinator().afterStatementExecution(); } } @@ -1547,7 +1547,7 @@ public abstract class AbstractCollectionPersister } finally { if ( !useBatch ) { - jdbcCoordinator.getResourceRegistry().release( st ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( st ); jdbcCoordinator.afterStatementExecution(); } } @@ -1668,7 +1668,7 @@ public abstract class AbstractCollectionPersister } finally { if ( !useBatch ) { - session.getJdbcCoordinator().getResourceRegistry().release( st ); + session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); session.getJdbcCoordinator().afterStatementExecution(); } } @@ -1779,7 +1779,7 @@ public abstract class AbstractCollectionPersister } finally { if ( !useBatch ) { - session.getJdbcCoordinator().getResourceRegistry().release( st ); + session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); session.getJdbcCoordinator().afterStatementExecution(); } } @@ -2202,11 +2202,11 @@ public abstract class AbstractCollectionPersister return rs.next() ? rs.getInt( 1 ) - baseIndex : 0; } finally { - jdbcCoordinator.getResourceRegistry().release( rs, st ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( rs, st ); } } finally { - jdbcCoordinator.getResourceRegistry().release( st ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( st ); jdbcCoordinator.afterStatementExecution(); } } @@ -2244,14 +2244,14 @@ public abstract class AbstractCollectionPersister return rs.next(); } finally { - jdbcCoordinator.getResourceRegistry().release( rs, st ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( rs, st ); } } catch ( TransientObjectException e ) { return false; } finally { - jdbcCoordinator.getResourceRegistry().release( st ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( st ); jdbcCoordinator.afterStatementExecution(); } } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java index 18fb3e1998..deb12346e0 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/collection/OneToManyPersister.java @@ -63,7 +63,7 @@ public class OneToManyPersister extends AbstractCollectionPersister { PersisterCreationContext creationContext) throws MappingException, CacheException { super( collectionBinding, cacheAccessStrategy, creationContext ); cascadeDeleteEnabled = collectionBinding.getKey().isCascadeDeleteEnabled() - && creationContext.getSessionFactory().getDialect().supportsCascadeDelete(); + && creationContext.getSessionFactory().getJdbcServices().getDialect().supportsCascadeDelete(); keyIsNullable = collectionBinding.getKey().isNullable(); keyIsUpdateable = collectionBinding.getKey().isUpdateable(); } @@ -276,7 +276,7 @@ public class OneToManyPersister extends AbstractCollectionPersister { } finally { if ( !useBatch ) { - session.getJdbcCoordinator().getResourceRegistry().release( st ); + session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); session.getJdbcCoordinator().afterStatementExecution(); } } @@ -389,7 +389,7 @@ public class OneToManyPersister extends AbstractCollectionPersister { } finally { if ( !useBatch ) { - session.getJdbcCoordinator().getResourceRegistry().release( st ); + session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); session.getJdbcCoordinator().afterStatementExecution(); } } @@ -461,7 +461,7 @@ public class OneToManyPersister extends AbstractCollectionPersister { } finally { if ( !useBatch ) { - session.getJdbcCoordinator().getResourceRegistry().release( st ); + session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); session.getJdbcCoordinator().afterStatementExecution(); } } @@ -470,7 +470,7 @@ public class OneToManyPersister extends AbstractCollectionPersister { return count; } catch (SQLException sqle) { - throw getFactory().getSQLExceptionHelper().convert( + throw getFactory().getJdbcServices().getSqlExceptionHelper().convert( sqle, "could not update collection rows: " + MessageHelper.collectionInfoString( this, collection, id, session ), diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index a604bc4c15..50289dcfa9 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -6096,7 +6096,7 @@ public abstract class AbstractEntityPersister assert selectableIterator.hasNext(); final Selectable selectable = selectableIterator.next(); - assert attrColumnExpression.equals( selectable.getText( sessionFactory.getDialect() ) ); + assert attrColumnExpression.equals( selectable.getText(sessionFactory.getJdbcServices().getDialect()) ); customReadExpr = selectable.getTemplate( dialect, sessionFactory.getQueryEngine().getSqmFunctionRegistry() ); customWriteExpr = selectable.getCustomWriteExpression(); diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java index 1940e8597f..346f8ba177 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/JoinedSubclassEntityPersister.java @@ -175,8 +175,8 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister { } else { final Column column = (Column) selectable; - explicitDiscriminatorColumnName = column.getQuotedName( factory.getDialect() ); - discriminatorAlias = column.getAlias( factory.getDialect(), persistentClass.getRootTable() ); + explicitDiscriminatorColumnName = column.getQuotedName(factory.getJdbcServices().getDialect()); + discriminatorAlias = column.getAlias(factory.getJdbcServices().getDialect(), persistentClass.getRootTable() ); } discriminatorType = (BasicType) persistentClass.getDiscriminator().getType(); if ( persistentClass.isDiscriminatorValueNull() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java index fa582475bb..91f88df256 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/UnionSubclassEntityPersister.java @@ -459,7 +459,6 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister { protected String generateSubquery(PersistentClass model, Mapping mapping) { Dialect dialect = getFactory().getJdbcServices().getDialect(); - Settings settings = getFactory().getSettings(); SqlStringGenerationContext sqlStringGenerationContext = getFactory().getSqlStringGenerationContext(); if ( !model.hasSubclasses() ) { diff --git a/hibernate-core/src/main/java/org/hibernate/stat/internal/StatisticsInitiator.java b/hibernate-core/src/main/java/org/hibernate/stat/internal/StatisticsInitiator.java index 856eb2b9d0..13ad9f106d 100644 --- a/hibernate-core/src/main/java/org/hibernate/stat/internal/StatisticsInitiator.java +++ b/hibernate-core/src/main/java/org/hibernate/stat/internal/StatisticsInitiator.java @@ -69,7 +69,7 @@ public class StatisticsInitiator implements SessionFactoryServiceInitiator { - String sql = "select TABLE_NAME , " + scope.getSessionFactory() - .getDialect() + String sql = "select TABLE_NAME , " + scope.getSessionFactory().getJdbcServices().getDialect() .currentDate() + " as daysOld from ALL_TABLES where TABLE_NAME = 'AUDIT_ACTIONS' "; session.createNativeQuery( sql ).addEntity( "t", AllTables.class ).list(); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/batch/BatchTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/batch/BatchTest.java index 6b4836f6d2..fbfc6efaf4 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/batch/BatchTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/batch/BatchTest.java @@ -48,26 +48,26 @@ public class BatchTest extends BaseCoreFunctionalTestCase { final int N = 5000; //26 secs with batch flush, 26 without //final int N = 100000; //53 secs with batch flush, OOME without //final int N = 250000; //137 secs with batch flush, OOME without - int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); + int batchSize = sessionFactory().getSessionFactoryOptions().getJdbcBatchSize(); doBatchInsertUpdate( N, batchSize ); System.out.println( System.currentTimeMillis() - start ); } @Test public void testBatchInsertUpdateSizeEqJdbcBatchSize() { - int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); + int batchSize = sessionFactory().getSessionFactoryOptions().getJdbcBatchSize(); doBatchInsertUpdate( 50, batchSize ); } @Test public void testBatchInsertUpdateSizeLtJdbcBatchSize() { - int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); + int batchSize = sessionFactory().getSessionFactoryOptions().getJdbcBatchSize(); doBatchInsertUpdate( 50, batchSize - 1 ); } @Test public void testBatchInsertUpdateSizeGtJdbcBatchSize() { - int batchSize = sessionFactory().getSettings().getJdbcBatchSize(); + int batchSize = sessionFactory().getSessionFactoryOptions().getJdbcBatchSize(); doBatchInsertUpdate( 50, batchSize + 1 ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/exception/SQLExceptionConversionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/exception/SQLExceptionConversionTest.java index 110e85f4b9..b43161a80f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/exception/SQLExceptionConversionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/exception/SQLExceptionConversionTest.java @@ -159,7 +159,7 @@ public class SQLExceptionConversionTest extends BaseCoreFunctionalTestCase { private void releaseStatement(Session session, PreparedStatement ps) { if ( ps != null ) { try { - ( (SessionImplementor) session ).getJdbcCoordinator().getResourceRegistry().release( ps ); + ((SessionImplementor) session).getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( ps ); } catch ( Throwable ignore ) { // ignore... diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/id/SequenceStyleGeneratorBehavesLikeSequeceHiloGeneratorWitZeroIncrementSizeTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/id/SequenceStyleGeneratorBehavesLikeSequeceHiloGeneratorWitZeroIncrementSizeTest.java index 39ef65eeb6..77a7190fd8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/id/SequenceStyleGeneratorBehavesLikeSequeceHiloGeneratorWitZeroIncrementSizeTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/id/SequenceStyleGeneratorBehavesLikeSequeceHiloGeneratorWitZeroIncrementSizeTest.java @@ -9,10 +9,8 @@ package org.hibernate.orm.test.id; import java.util.Properties; import org.hibernate.Session; -import org.hibernate.Transaction; import org.hibernate.boot.Metadata; import org.hibernate.boot.MetadataSources; -import org.hibernate.boot.model.naming.ObjectNameNormalizer; import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.spi.MetadataBuildingContext; @@ -82,7 +80,7 @@ public class SequenceStyleGeneratorBehavesLikeSequeceHiloGeneratorWitZeroIncreme sessionFactory = (SessionFactoryImplementor) metadata.buildSessionFactory(); generator.initialize( sessionFactory.getSqlStringGenerationContext() ); - sequenceValueExtractor = new SequenceValueExtractor( sessionFactory.getDialect(), TEST_SEQUENCE ); + sequenceValueExtractor = new SequenceValueExtractor(sessionFactory.getJdbcServices().getDialect(), TEST_SEQUENCE ); } @AfterEach diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/GeneralWorkTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/GeneralWorkTest.java index a617b51595..1077012441 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/GeneralWorkTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/GeneralWorkTest.java @@ -154,7 +154,7 @@ public class GeneralWorkTest extends BaseCoreFunctionalTestCase { return; } try { - s.getJdbcCoordinator().getResourceRegistry().release( statement ); + s.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( statement ); } catch (Exception e) { // ignore @@ -166,7 +166,7 @@ public class GeneralWorkTest extends BaseCoreFunctionalTestCase { return; } try { - s.getJdbcCoordinator().getResourceRegistry().release( resultSet, statement ); + s.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( resultSet, statement ); } catch (Exception e) { // ignore diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/internal/AggressiveReleaseTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/internal/AggressiveReleaseTest.java index c46e6d35ed..b672103584 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/internal/AggressiveReleaseTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/internal/AggressiveReleaseTest.java @@ -131,7 +131,7 @@ public class AggressiveReleaseTest extends BaseSessionFactoryFunctionalTest { ps.setLong( 1, 1 ); ps.setString( 2, "name" ); jdbcCoord.getResultSetReturn().execute( ps ); - assertTrue( jdbcCoord.getResourceRegistry().hasRegisteredResources() ); + assertTrue( jdbcCoord.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); assertEquals( 1, connectionProvider.getAcquiredConnections().size() ); assertEquals( 0, connectionProvider.getReleasedConnections().size() ); resourceRegistry.release( ps ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/internal/BasicConnectionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/internal/BasicConnectionTest.java index f2cd56b36c..55f7e7ccaa 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/internal/BasicConnectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/internal/BasicConnectionTest.java @@ -106,6 +106,6 @@ public class BasicConnectionTest extends BaseCoreFunctionalTestCase { } private ResourceRegistry getResourceRegistry(JdbcCoordinator jdbcCoord) { - return jdbcCoord.getResourceRegistry(); - } + return jdbcCoord.getLogicalConnection().getResourceRegistry(); + } } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/internal/BatchingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/internal/BatchingTest.java index 5ed52f044d..614b712b5c 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/internal/BatchingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jdbc/internal/BatchingTest.java @@ -66,10 +66,10 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey // ignore if the DB doesn't support "if exists" and the table doesn't exist } jdbcCoordinator.getResultSetReturn().execute( statement, "create table SANDBOX_JDBC_TST ( ID integer, NAME varchar(100) )" ); - assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); assertTrue( logicalConnection.isPhysicallyConnected() ); - jdbcCoordinator.getResourceRegistry().release( statement ); - assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( statement ); + assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); assertTrue( logicalConnection.isPhysicallyConnected() ); // after_transaction specified // ok, now we can get down to it... @@ -94,12 +94,12 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey insertBatch.addToBatch(); assertEquals( 0, batchObserver.getExplicitExecutionCount() ); assertEquals( 1, batchObserver.getImplicitExecutionCount() ); - assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); insertBatch.execute(); assertEquals( 1, batchObserver.getExplicitExecutionCount() ); assertEquals( 1, batchObserver.getImplicitExecutionCount() ); - assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); insertBatch.release(); @@ -124,10 +124,10 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey catch ( Exception e ) { // ignore if the DB doesn't support "if exists" and the table doesn't exist } jdbcCoordinator.getResultSetReturn().execute( statement, "create table SANDBOX_JDBC_TST ( ID integer, NAME varchar(100) )" ); - assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); assertTrue( logicalConnection.isPhysicallyConnected() ); - jdbcCoordinator.getResourceRegistry().release( statement ); - assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( statement ); + assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); assertTrue( logicalConnection.isPhysicallyConnected() ); // after_transaction specified // ok, now we can get down to it... @@ -152,7 +152,7 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey insertBatch.addToBatch(); assertEquals( 0, batchObserver.getExplicitExecutionCount() ); assertEquals( 0, batchObserver.getImplicitExecutionCount() ); - assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); PreparedStatement insert2 = insertBatch.getBatchStatement( insertSql, false ); assertSame( insert, insert2 ); @@ -164,12 +164,12 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey insertBatch.addToBatch(); assertEquals( 0, batchObserver.getExplicitExecutionCount() ); assertEquals( 1, batchObserver.getImplicitExecutionCount() ); - assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); insertBatch.execute(); assertEquals( 1, batchObserver.getExplicitExecutionCount() ); assertEquals( 1, batchObserver.getImplicitExecutionCount() ); - assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); insertBatch.release(); @@ -195,10 +195,10 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey catch ( Exception e ) { // ignore if the DB doesn't support "if exists" and the table doesn't exist } jdbcCoordinator.getResultSetReturn().execute( statement, "create table SANDBOX_JDBC_TST ( ID integer, NAME varchar(100) )" ); - assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); assertTrue( logicalConnection.isPhysicallyConnected() ); - jdbcCoordinator.getResourceRegistry().release( statement ); - assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( statement ); + assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); assertTrue( logicalConnection.isPhysicallyConnected() ); // after_transaction specified // ok, now we can get down to it... @@ -223,7 +223,7 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey insertBatch.addToBatch(); assertEquals( 0, batchObserver.getExplicitExecutionCount() ); assertEquals( 0, batchObserver.getImplicitExecutionCount() ); - assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); PreparedStatement insert2 = insertBatch.getBatchStatement( insertSql, false ); assertSame( insert, insert2 ); @@ -235,7 +235,7 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey insertBatch.addToBatch(); assertEquals( 0, batchObserver.getExplicitExecutionCount() ); assertEquals( 0, batchObserver.getImplicitExecutionCount() ); - assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); PreparedStatement insert3 = insertBatch.getBatchStatement( insertSql, false ); assertSame( insert, insert3 ); @@ -247,12 +247,12 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey insertBatch.addToBatch(); assertEquals( 0, batchObserver.getExplicitExecutionCount() ); assertEquals( 1, batchObserver.getImplicitExecutionCount() ); - assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); insertBatch.execute(); assertEquals( 1, batchObserver.getExplicitExecutionCount() ); assertEquals( 1, batchObserver.getImplicitExecutionCount() ); - assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() ); + assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() ); insertBatch.release(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/mixed/MixedTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/mixed/MixedTest.java index 0ced77ffbd..48b98787ad 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/mixed/MixedTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/mixed/MixedTest.java @@ -66,7 +66,7 @@ public class MixedTest { Long did = doc.getId(); Long d2id = doc2.getId(); - if ( !scope.getSessionFactory().getDialect().supportsExpectedLobUsagePattern() ) { + if ( !scope.getSessionFactory().getJdbcServices().getDialect().supportsExpectedLobUsagePattern() ) { SkipLog.reportSkip( "database/driver does not support expected LOB usage pattern", "LOB support" ); return; } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/rowid/RowIdTest2.java b/hibernate-core/src/test/java/org/hibernate/orm/test/rowid/RowIdTest2.java index 751282917b..70720efebe 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/rowid/RowIdTest2.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/rowid/RowIdTest2.java @@ -51,7 +51,7 @@ public class RowIdTest2 { st, "create table Point (\"x\" number(19,2) not null, \"y\" number(19,2) not null, description varchar2(255) )" ); - session.getJdbcCoordinator().getResourceRegistry().release( st ); + session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st ); } ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/sharedSession/SessionWithSharedConnectionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/sharedSession/SessionWithSharedConnectionTest.java index 61cecf71f2..dd48bed39a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/sharedSession/SessionWithSharedConnectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/sharedSession/SessionWithSharedConnectionTest.java @@ -58,10 +58,9 @@ public class SessionWithSharedConnectionTest { // secondSession.createCriteria( IrrelevantEntity.class ).list(); //the list should have registered and then released a JDBC resource - assertFalse( + assertFalse( ((SessionImplementor) secondSession) - .getJdbcCoordinator() - .getResourceRegistry() + .getJdbcCoordinator().getLogicalConnection().getResourceRegistry() .hasRegisteredResources() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/autodiscovery/AutoDiscoveryTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/autodiscovery/AutoDiscoveryTest.java index a5cf7cc021..d6af4c981d 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/autodiscovery/AutoDiscoveryTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/autodiscovery/AutoDiscoveryTest.java @@ -23,7 +23,6 @@ import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.junit.Assert; import org.junit.Test; -import static org.hibernate.testing.junit4.ExtraAssertions.assertTyping; import static org.junit.Assert.assertEquals; /** @@ -129,8 +128,8 @@ public class AutoDiscoveryTest extends BaseCoreFunctionalTestCase { Assert.assertFalse( "bad dialect.getColumnAliasExtractor impl", column1Alias.equals( column2Alias ) ); } finally { - sessionImplementor.getJdbcCoordinator().getResourceRegistry().release( rs, ps ); - sessionImplementor.getJdbcCoordinator().getResourceRegistry().release( ps ); + sessionImplementor.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( rs, ps ); + sessionImplementor.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( ps ); } } } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/temporal/TimePropertyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/temporal/TimePropertyTest.java index c6228e2a51..5d05b42b2b 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/temporal/TimePropertyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/temporal/TimePropertyTest.java @@ -69,7 +69,7 @@ public class TimePropertyTest { final String queryString; - if ( SQLServerDialect.class.isAssignableFrom( scope.getSessionFactory().getDialect().getClass() ) ) { + if ( SQLServerDialect.class.isAssignableFrom( scope.getSessionFactory().getJdbcServices().getDialect().getClass() ) ) { queryString = "from TimePropertyTest$Entity where tAsDate = cast ( ?1 as time )"; } else { diff --git a/hibernate-core/src/test/java/org/hibernate/test/resulttransformer/ResultTransformerTest.java b/hibernate-core/src/test/java/org/hibernate/test/resulttransformer/ResultTransformerTest.java index c123036fb8..55a588536d 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/resulttransformer/ResultTransformerTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/resulttransformer/ResultTransformerTest.java @@ -65,7 +65,7 @@ public class ResultTransformerTest { ScrollableResults sr = q.scroll(); // HANA supports only ResultSet.TYPE_FORWARD_ONLY and // does not support java.sql.ResultSet.first() - if ( scope.getSessionFactory().getDialect() instanceof AbstractHANADialect ) { + if ( scope.getSessionFactory().getJdbcServices().getDialect() instanceof AbstractHANADialect ) { sr.next(); } else {