remove use of deprecated accessors of SessionFactoryImplementor
This commit is contained in:
parent
be831f9690
commit
4b26cb5876
|
@ -172,7 +172,7 @@ public class ThreadLocalSessionContext extends AbstractCurrentSessionContext {
|
||||||
* @return The connection release mode for any built sessions.
|
* @return The connection release mode for any built sessions.
|
||||||
*/
|
*/
|
||||||
protected ConnectionReleaseMode getConnectionReleaseMode() {
|
protected ConnectionReleaseMode getConnectionReleaseMode() {
|
||||||
return factory().getSettings().getConnectionReleaseMode();
|
return factory().getSessionFactoryOptions().getPhysicalConnectionHandlingMode().getReleaseMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Session wrap(Session session) {
|
protected Session wrap(Session session) {
|
||||||
|
|
|
@ -1518,7 +1518,8 @@ public abstract class Dialect implements ConversionContext {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
catch (SQLException e ) {
|
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 {
|
else {
|
||||||
|
@ -1538,7 +1539,7 @@ public abstract class Dialect implements ConversionContext {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
catch (SQLException e ) {
|
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 {
|
else {
|
||||||
|
@ -1558,7 +1559,7 @@ public abstract class Dialect implements ConversionContext {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
catch (SQLException e ) {
|
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 {
|
else {
|
||||||
|
@ -1585,7 +1586,7 @@ public abstract class Dialect implements ConversionContext {
|
||||||
: lobCreator.createBlob( original.getBinaryStream(), original.length() );
|
: lobCreator.createBlob( original.getBinaryStream(), original.length() );
|
||||||
}
|
}
|
||||||
catch (SQLException e) {
|
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() );
|
: lobCreator.createClob( original.getCharacterStream(), original.length() );
|
||||||
}
|
}
|
||||||
catch (SQLException e) {
|
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() );
|
: lobCreator.createNClob( original.getCharacterStream(), original.length() );
|
||||||
}
|
}
|
||||||
catch (SQLException e) {
|
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" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class PessimisticReadUpdateLockingStrategy implements LockingStrategy {
|
||||||
|
|
||||||
protected String generateLockString() {
|
protected String generateLockString() {
|
||||||
final SessionFactoryImplementor factory = lockable.getFactory();
|
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.setTableName( lockable.getRootTableName() );
|
||||||
update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() );
|
update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() );
|
||||||
update.setVersionColumnName( lockable.getVersionColumnName() );
|
update.setVersionColumnName( lockable.getVersionColumnName() );
|
||||||
|
|
|
@ -119,7 +119,7 @@ public class PessimisticWriteUpdateLockingStrategy implements LockingStrategy {
|
||||||
|
|
||||||
protected String generateLockString() {
|
protected String generateLockString() {
|
||||||
final SessionFactoryImplementor factory = lockable.getFactory();
|
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.setTableName( lockable.getRootTableName() );
|
||||||
update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() );
|
update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() );
|
||||||
update.setVersionColumnName( lockable.getVersionColumnName() );
|
update.setVersionColumnName( lockable.getVersionColumnName() );
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class UpdateLockingStrategy implements LockingStrategy {
|
||||||
|
|
||||||
protected String generateLockString() {
|
protected String generateLockString() {
|
||||||
final SessionFactoryImplementor factory = lockable.getFactory();
|
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.setTableName( lockable.getRootTableName() );
|
||||||
update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() );
|
update.addPrimaryKeyColumns( lockable.getRootTableIdentifierColumnNames() );
|
||||||
update.setVersionColumnName( lockable.getVersionColumnName() );
|
update.setVersionColumnName( lockable.getVersionColumnName() );
|
||||||
|
|
|
@ -214,7 +214,7 @@ public final class ForeignKeys {
|
||||||
// case we definitely need to nullify
|
// case we definitely need to nullify
|
||||||
if ( object == self ) {
|
if ( object == self ) {
|
||||||
return isEarlyInsert
|
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
|
// See if the entity is already bound to this session, if not look at the
|
||||||
|
|
|
@ -154,7 +154,7 @@ public abstract class AbstractBatchImpl implements Batch {
|
||||||
|
|
||||||
protected void releaseStatements() {
|
protected void releaseStatements() {
|
||||||
final LinkedHashMap<String, PreparedStatement> statements = getStatements();
|
final LinkedHashMap<String, PreparedStatement> statements = getStatements();
|
||||||
final ResourceRegistry resourceRegistry = jdbcCoordinator.getResourceRegistry();
|
final ResourceRegistry resourceRegistry = jdbcCoordinator.getLogicalConnection().getResourceRegistry();
|
||||||
for ( PreparedStatement statement : statements.values() ) {
|
for ( PreparedStatement statement : statements.values() ) {
|
||||||
clearBatch( statement );
|
clearBatch( statement );
|
||||||
resourceRegistry.release( statement );
|
resourceRegistry.release( statement );
|
||||||
|
|
|
@ -45,7 +45,7 @@ public class NonBatchingBatch extends AbstractBatchImpl {
|
||||||
final PreparedStatement statement = entry.getValue();
|
final PreparedStatement statement = entry.getValue();
|
||||||
final int rowCount = jdbcCoordinator.getResultSetReturn().executeUpdate( statement );
|
final int rowCount = jdbcCoordinator.getResultSetReturn().executeUpdate( statement );
|
||||||
getKey().getExpectation().verifyOutcome( rowCount, statement, 0, statementSQL );
|
getKey().getExpectation().verifyOutcome( rowCount, statement, 0, statementSQL );
|
||||||
jdbcCoordinator.getResourceRegistry().release( statement );
|
jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( statement );
|
||||||
jdbcCoordinator.afterStatementExecution();
|
jdbcCoordinator.afterStatementExecution();
|
||||||
}
|
}
|
||||||
catch ( SQLException e ) {
|
catch ( SQLException e ) {
|
||||||
|
|
|
@ -274,11 +274,11 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void releaseResources() {
|
private void releaseResources() {
|
||||||
getResourceRegistry().releaseResources();
|
getLogicalConnection().getResourceRegistry().releaseResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasRegisteredResources() {
|
private boolean hasRegisteredResources() {
|
||||||
return getResourceRegistry().hasRegisteredResources();
|
return getLogicalConnection().getResourceRegistry().hasRegisteredResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
private ConnectionReleaseMode determineConnectionReleaseMode(
|
private ConnectionReleaseMode determineConnectionReleaseMode(
|
||||||
|
|
|
@ -227,7 +227,7 @@ public class ResultSetReturnImpl implements ResultSetReturn {
|
||||||
|
|
||||||
private void postExtract(ResultSet rs, Statement st) {
|
private void postExtract(ResultSet rs, Statement st) {
|
||||||
if ( rs != null ) {
|
if ( rs != null ) {
|
||||||
jdbcCoordinator.getResourceRegistry().register( rs, st );
|
jdbcCoordinator.getLogicalConnection().getResourceRegistry().register( rs, st );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ class StatementPreparerImpl implements StatementPreparer {
|
||||||
public Statement createStatement() {
|
public Statement createStatement() {
|
||||||
try {
|
try {
|
||||||
final Statement statement = connection().createStatement();
|
final Statement statement = connection().createStatement();
|
||||||
jdbcCoordinator.getResourceRegistry().register( statement, true );
|
jdbcCoordinator.getLogicalConnection().getResourceRegistry().register( statement, true );
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
catch ( SQLException e ) {
|
catch ( SQLException e ) {
|
||||||
|
@ -190,7 +190,7 @@ class StatementPreparerImpl implements StatementPreparer {
|
||||||
protected abstract PreparedStatement doPrepare() throws SQLException;
|
protected abstract PreparedStatement doPrepare() throws SQLException;
|
||||||
|
|
||||||
public void postProcess(PreparedStatement preparedStatement) throws SQLException {
|
public void postProcess(PreparedStatement preparedStatement) throws SQLException {
|
||||||
jdbcCoordinator.getResourceRegistry().register( preparedStatement, true );
|
jdbcCoordinator.getLogicalConnection().getResourceRegistry().register( preparedStatement, true );
|
||||||
// logicalConnection().notifyObserversStatementPrepared();
|
// logicalConnection().notifyObserversStatementPrepared();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,13 +12,11 @@ import java.io.Serializable;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
|
|
||||||
import org.hibernate.ConnectionReleaseMode;
|
|
||||||
import org.hibernate.engine.jdbc.batch.spi.Batch;
|
import org.hibernate.engine.jdbc.batch.spi.Batch;
|
||||||
import org.hibernate.engine.jdbc.batch.spi.BatchKey;
|
import org.hibernate.engine.jdbc.batch.spi.BatchKey;
|
||||||
import org.hibernate.jdbc.WorkExecutorVisitable;
|
import org.hibernate.jdbc.WorkExecutorVisitable;
|
||||||
import org.hibernate.resource.jdbc.ResourceRegistry;
|
import org.hibernate.resource.jdbc.ResourceRegistry;
|
||||||
import org.hibernate.resource.jdbc.spi.LogicalConnectionImplementor;
|
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.backend.jdbc.spi.JdbcResourceTransactionAccess;
|
||||||
import org.hibernate.resource.transaction.spi.TransactionCoordinatorOwner;
|
import org.hibernate.resource.transaction.spi.TransactionCoordinatorOwner;
|
||||||
|
|
||||||
|
|
|
@ -202,22 +202,22 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
return delegate.getProperties();
|
return delegate.getProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public EntityPersister getEntityPersister(String entityName) throws MappingException {
|
public EntityPersister getEntityPersister(String entityName) throws MappingException {
|
||||||
return delegate.getEntityPersister( entityName );
|
return delegate.getEntityPersister( entityName );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public Map<String, EntityPersister> getEntityPersisters() {
|
public Map<String, EntityPersister> getEntityPersisters() {
|
||||||
return delegate.getEntityPersisters();
|
return delegate.getEntityPersisters();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public CollectionPersister getCollectionPersister(String role) throws MappingException {
|
public CollectionPersister getCollectionPersister(String role) throws MappingException {
|
||||||
return delegate.getCollectionPersister( role );
|
return delegate.getCollectionPersister( role );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public Map<String, CollectionPersister> getCollectionPersisters() {
|
public Map<String, CollectionPersister> getCollectionPersisters() {
|
||||||
return delegate.getCollectionPersisters();
|
return delegate.getCollectionPersisters();
|
||||||
}
|
}
|
||||||
|
@ -232,17 +232,17 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
return delegate.getSqlStringGenerationContext();
|
return delegate.getSqlStringGenerationContext();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public Dialect getDialect() {
|
public Dialect getDialect() {
|
||||||
return delegate.getDialect();
|
return delegate.getJdbcServices().getDialect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public String[] getImplementors(String className) throws MappingException {
|
public String[] getImplementors(String className) throws MappingException {
|
||||||
return delegate.getImplementors( className );
|
return delegate.getImplementors( className );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public String getImportedClassName(String name) {
|
public String getImportedClassName(String name) {
|
||||||
return delegate.getImportedClassName( name );
|
return delegate.getImportedClassName( name );
|
||||||
}
|
}
|
||||||
|
@ -257,22 +257,22 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
return delegate.bestGuessEntityName( object );
|
return delegate.bestGuessEntityName( object );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public StatisticsImplementor getStatisticsImplementor() {
|
public StatisticsImplementor getStatisticsImplementor() {
|
||||||
return delegate.getStatistics();
|
return delegate.getStatistics();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public SQLExceptionConverter getSQLExceptionConverter() {
|
public SQLExceptionConverter getSQLExceptionConverter() {
|
||||||
return delegate.getSQLExceptionConverter();
|
return delegate.getSQLExceptionConverter();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public SqlExceptionHelper getSQLExceptionHelper() {
|
public SqlExceptionHelper getSQLExceptionHelper() {
|
||||||
return delegate.getSQLExceptionHelper();
|
return delegate.getJdbcServices().getSqlExceptionHelper();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public Settings getSettings() {
|
public Settings getSettings() {
|
||||||
return delegate.getSettings();
|
return delegate.getSettings();
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
return delegate.openTemporarySession();
|
return delegate.openTemporarySession();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public Set<String> getCollectionRolesByEntityParticipant(String entityName) {
|
public Set<String> getCollectionRolesByEntityParticipant(String entityName) {
|
||||||
return delegate.getCollectionRolesByEntityParticipant( entityName );
|
return delegate.getCollectionRolesByEntityParticipant( entityName );
|
||||||
}
|
}
|
||||||
|
@ -327,7 +327,7 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
return delegate.getCurrentTenantIdentifierResolver();
|
return delegate.getCurrentTenantIdentifierResolver();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public Iterable<EntityNameResolver> iterateEntityNameResolvers() {
|
public Iterable<EntityNameResolver> iterateEntityNameResolvers() {
|
||||||
return delegate.iterateEntityNameResolvers();
|
return delegate.iterateEntityNameResolvers();
|
||||||
}
|
}
|
||||||
|
@ -337,12 +337,12 @@ public class SessionFactoryDelegatingImpl implements SessionFactoryImplementor,
|
||||||
return delegate.getFastSessionServices();
|
return delegate.getFastSessionServices();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public EntityPersister locateEntityPersister(Class<?> byClass) {
|
public EntityPersister locateEntityPersister(Class<?> byClass) {
|
||||||
return delegate.locateEntityPersister( byClass );
|
return delegate.locateEntityPersister( byClass );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override @Deprecated
|
||||||
public EntityPersister locateEntityPersister(String byName) {
|
public EntityPersister locateEntityPersister(String byName) {
|
||||||
return delegate.locateEntityPersister( byName );
|
return delegate.locateEntityPersister( byName );
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,7 +240,6 @@ public interface SessionFactoryImplementor
|
||||||
* @deprecated since 5.0; use {@link #getSessionFactoryOptions()} instead
|
* @deprecated since 5.0; use {@link #getSessionFactoryOptions()} instead
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
Settings getSettings();
|
Settings getSettings();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class DefaultDeleteEventListener implements DeleteEventListener, Callback
|
||||||
transientEntities
|
transientEntities
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( source.getFactory().getSettings().isIdentifierRollbackEnabled() ) {
|
if ( source.getFactory().getSessionFactoryOptions().isIdentifierRollbackEnabled() ) {
|
||||||
persister.resetIdentifier( entity, id, version, source );
|
persister.resetIdentifier( entity, id, version, source );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -163,7 +163,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont
|
||||||
this.flushMode = options.getInitialSessionFlushMode();
|
this.flushMode = options.getInitialSessionFlushMode();
|
||||||
|
|
||||||
this.tenantIdentifier = options.getTenantIdentifier();
|
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" );
|
throw new HibernateException( "SessionFactory configured for multi-tenancy, but no tenant identifier specified" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ public final class FastSessionServices {
|
||||||
this.preferredSqlTypeCodeForBoolean = sessionFactoryOptions.getPreferredSqlTypeCodeForBoolean();
|
this.preferredSqlTypeCodeForBoolean = sessionFactoryOptions.getPreferredSqlTypeCodeForBoolean();
|
||||||
this.defaultTimeZoneStorageStrategy = sessionFactoryOptions.getDefaultTimeZoneStorageStrategy();
|
this.defaultTimeZoneStorageStrategy = sessionFactoryOptions.getDefaultTimeZoneStorageStrategy();
|
||||||
this.defaultJdbcBatchSize = sessionFactoryOptions.getJdbcBatchSize();
|
this.defaultJdbcBatchSize = sessionFactoryOptions.getJdbcBatchSize();
|
||||||
this.requiresMultiTenantConnectionProvider = sf.getSettings().isMultiTenancyEnabled();
|
this.requiresMultiTenantConnectionProvider = sf.getSessionFactoryOptions().isMultiTenancyEnabled();
|
||||||
|
|
||||||
//Some "hot" services:
|
//Some "hot" services:
|
||||||
this.connectionProvider = requiresMultiTenantConnectionProvider ? null : sr.getService( ConnectionProvider.class );
|
this.connectionProvider = requiresMultiTenantConnectionProvider ? null : sr.getService( ConnectionProvider.class );
|
||||||
|
|
|
@ -301,8 +301,8 @@ public abstract class AbstractCollectionPersister
|
||||||
cacheEntryStructure = UnstructuredCacheEntry.INSTANCE;
|
cacheEntryStructure = UnstructuredCacheEntry.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dialect = factory.getDialect();
|
dialect = factory.getJdbcServices().getDialect();
|
||||||
sqlExceptionHelper = factory.getSQLExceptionHelper();
|
sqlExceptionHelper = factory.getJdbcServices().getSqlExceptionHelper();
|
||||||
collectionType = collectionBootDescriptor.getCollectionType();
|
collectionType = collectionBootDescriptor.getCollectionType();
|
||||||
navigableRole = new NavigableRole( collectionBootDescriptor.getRole() );
|
navigableRole = new NavigableRole( collectionBootDescriptor.getRole() );
|
||||||
entityName = collectionBootDescriptor.getOwnerEntityName();
|
entityName = collectionBootDescriptor.getOwnerEntityName();
|
||||||
|
@ -522,7 +522,7 @@ public abstract class AbstractCollectionPersister
|
||||||
identifierColumnAlias = col.getAlias( dialect );
|
identifierColumnAlias = col.getAlias( dialect );
|
||||||
identifierGenerator = idColl.getIdentifier().createIdentifierGenerator(
|
identifierGenerator = idColl.getIdentifier().createIdentifierGenerator(
|
||||||
persisterCreationContext.getBootstrapContext().getIdentifierGeneratorFactory(),
|
persisterCreationContext.getBootstrapContext().getIdentifierGeneratorFactory(),
|
||||||
factory.getDialect(),
|
factory.getJdbcServices().getDialect(),
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
identifierGenerator.initialize( creationContext.getSessionFactory().getSqlStringGenerationContext() );
|
identifierGenerator.initialize( creationContext.getSessionFactory().getSqlStringGenerationContext() );
|
||||||
|
@ -1435,7 +1435,7 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if ( !useBatch ) {
|
if ( !useBatch ) {
|
||||||
session.getJdbcCoordinator().getResourceRegistry().release( st );
|
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st );
|
||||||
session.getJdbcCoordinator().afterStatementExecution();
|
session.getJdbcCoordinator().afterStatementExecution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1547,7 +1547,7 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if ( !useBatch ) {
|
if ( !useBatch ) {
|
||||||
jdbcCoordinator.getResourceRegistry().release( st );
|
jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( st );
|
||||||
jdbcCoordinator.afterStatementExecution();
|
jdbcCoordinator.afterStatementExecution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1668,7 +1668,7 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if ( !useBatch ) {
|
if ( !useBatch ) {
|
||||||
session.getJdbcCoordinator().getResourceRegistry().release( st );
|
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st );
|
||||||
session.getJdbcCoordinator().afterStatementExecution();
|
session.getJdbcCoordinator().afterStatementExecution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1779,7 +1779,7 @@ public abstract class AbstractCollectionPersister
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if ( !useBatch ) {
|
if ( !useBatch ) {
|
||||||
session.getJdbcCoordinator().getResourceRegistry().release( st );
|
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st );
|
||||||
session.getJdbcCoordinator().afterStatementExecution();
|
session.getJdbcCoordinator().afterStatementExecution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2202,11 +2202,11 @@ public abstract class AbstractCollectionPersister
|
||||||
return rs.next() ? rs.getInt( 1 ) - baseIndex : 0;
|
return rs.next() ? rs.getInt( 1 ) - baseIndex : 0;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
jdbcCoordinator.getResourceRegistry().release( rs, st );
|
jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( rs, st );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
jdbcCoordinator.getResourceRegistry().release( st );
|
jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( st );
|
||||||
jdbcCoordinator.afterStatementExecution();
|
jdbcCoordinator.afterStatementExecution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2244,14 +2244,14 @@ public abstract class AbstractCollectionPersister
|
||||||
return rs.next();
|
return rs.next();
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
jdbcCoordinator.getResourceRegistry().release( rs, st );
|
jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( rs, st );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch ( TransientObjectException e ) {
|
catch ( TransientObjectException e ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
jdbcCoordinator.getResourceRegistry().release( st );
|
jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( st );
|
||||||
jdbcCoordinator.afterStatementExecution();
|
jdbcCoordinator.afterStatementExecution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
||||||
PersisterCreationContext creationContext) throws MappingException, CacheException {
|
PersisterCreationContext creationContext) throws MappingException, CacheException {
|
||||||
super( collectionBinding, cacheAccessStrategy, creationContext );
|
super( collectionBinding, cacheAccessStrategy, creationContext );
|
||||||
cascadeDeleteEnabled = collectionBinding.getKey().isCascadeDeleteEnabled()
|
cascadeDeleteEnabled = collectionBinding.getKey().isCascadeDeleteEnabled()
|
||||||
&& creationContext.getSessionFactory().getDialect().supportsCascadeDelete();
|
&& creationContext.getSessionFactory().getJdbcServices().getDialect().supportsCascadeDelete();
|
||||||
keyIsNullable = collectionBinding.getKey().isNullable();
|
keyIsNullable = collectionBinding.getKey().isNullable();
|
||||||
keyIsUpdateable = collectionBinding.getKey().isUpdateable();
|
keyIsUpdateable = collectionBinding.getKey().isUpdateable();
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,7 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if ( !useBatch ) {
|
if ( !useBatch ) {
|
||||||
session.getJdbcCoordinator().getResourceRegistry().release( st );
|
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st );
|
||||||
session.getJdbcCoordinator().afterStatementExecution();
|
session.getJdbcCoordinator().afterStatementExecution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -389,7 +389,7 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if ( !useBatch ) {
|
if ( !useBatch ) {
|
||||||
session.getJdbcCoordinator().getResourceRegistry().release( st );
|
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st );
|
||||||
session.getJdbcCoordinator().afterStatementExecution();
|
session.getJdbcCoordinator().afterStatementExecution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,7 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
if ( !useBatch ) {
|
if ( !useBatch ) {
|
||||||
session.getJdbcCoordinator().getResourceRegistry().release( st );
|
session.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( st );
|
||||||
session.getJdbcCoordinator().afterStatementExecution();
|
session.getJdbcCoordinator().afterStatementExecution();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ public class OneToManyPersister extends AbstractCollectionPersister {
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
catch (SQLException sqle) {
|
catch (SQLException sqle) {
|
||||||
throw getFactory().getSQLExceptionHelper().convert(
|
throw getFactory().getJdbcServices().getSqlExceptionHelper().convert(
|
||||||
sqle,
|
sqle,
|
||||||
"could not update collection rows: " +
|
"could not update collection rows: " +
|
||||||
MessageHelper.collectionInfoString( this, collection, id, session ),
|
MessageHelper.collectionInfoString( this, collection, id, session ),
|
||||||
|
|
|
@ -6096,7 +6096,7 @@ public abstract class AbstractEntityPersister
|
||||||
assert selectableIterator.hasNext();
|
assert selectableIterator.hasNext();
|
||||||
final Selectable selectable = selectableIterator.next();
|
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() );
|
customReadExpr = selectable.getTemplate( dialect, sessionFactory.getQueryEngine().getSqmFunctionRegistry() );
|
||||||
customWriteExpr = selectable.getCustomWriteExpression();
|
customWriteExpr = selectable.getCustomWriteExpression();
|
||||||
|
|
|
@ -175,8 +175,8 @@ public class JoinedSubclassEntityPersister extends AbstractEntityPersister {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
final Column column = (Column) selectable;
|
final Column column = (Column) selectable;
|
||||||
explicitDiscriminatorColumnName = column.getQuotedName( factory.getDialect() );
|
explicitDiscriminatorColumnName = column.getQuotedName(factory.getJdbcServices().getDialect());
|
||||||
discriminatorAlias = column.getAlias( factory.getDialect(), persistentClass.getRootTable() );
|
discriminatorAlias = column.getAlias(factory.getJdbcServices().getDialect(), persistentClass.getRootTable() );
|
||||||
}
|
}
|
||||||
discriminatorType = (BasicType<?>) persistentClass.getDiscriminator().getType();
|
discriminatorType = (BasicType<?>) persistentClass.getDiscriminator().getType();
|
||||||
if ( persistentClass.isDiscriminatorValueNull() ) {
|
if ( persistentClass.isDiscriminatorValueNull() ) {
|
||||||
|
|
|
@ -459,7 +459,6 @@ public class UnionSubclassEntityPersister extends AbstractEntityPersister {
|
||||||
protected String generateSubquery(PersistentClass model, Mapping mapping) {
|
protected String generateSubquery(PersistentClass model, Mapping mapping) {
|
||||||
|
|
||||||
Dialect dialect = getFactory().getJdbcServices().getDialect();
|
Dialect dialect = getFactory().getJdbcServices().getDialect();
|
||||||
Settings settings = getFactory().getSettings();
|
|
||||||
SqlStringGenerationContext sqlStringGenerationContext = getFactory().getSqlStringGenerationContext();
|
SqlStringGenerationContext sqlStringGenerationContext = getFactory().getSqlStringGenerationContext();
|
||||||
|
|
||||||
if ( !model.hasSubclasses() ) {
|
if ( !model.hasSubclasses() ) {
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class StatisticsInitiator implements SessionFactoryServiceInitiator<Stati
|
||||||
if ( configValue == null ) {
|
if ( configValue == null ) {
|
||||||
statisticsFactory = null; //We'll use the default
|
statisticsFactory = null; //We'll use the default
|
||||||
}
|
}
|
||||||
else if ( StatisticsFactory.class.isInstance( configValue ) ) {
|
else if ( configValue instanceof StatisticsFactory ) {
|
||||||
statisticsFactory = (StatisticsFactory) configValue;
|
statisticsFactory = (StatisticsFactory) configValue;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -83,7 +83,7 @@ public class StatisticsInitiator implements SessionFactoryServiceInitiator<Stati
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
throw new HibernateException(
|
throw new HibernateException(
|
||||||
"Unable to instantiate specified StatisticsFactory implementation [" + configValue.toString() + "]",
|
"Unable to instantiate specified StatisticsFactory implementation [" + configValue + "]",
|
||||||
e
|
e
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ public class StatisticsInitiator implements SessionFactoryServiceInitiator<Stati
|
||||||
else {
|
else {
|
||||||
statistics = statisticsFactory.buildStatistics( sessionFactory );
|
statistics = statisticsFactory.buildStatistics( sessionFactory );
|
||||||
}
|
}
|
||||||
final boolean enabled = sessionFactory.getSettings().isStatisticsEnabled();
|
final boolean enabled = sessionFactory.getSessionFactoryOptions().isStatisticsEnabled();
|
||||||
statistics.setStatisticsEnabled( enabled );
|
statistics.setStatisticsEnabled( enabled );
|
||||||
LOG.debugf( "Statistics initialized [enabled=%s]", enabled );
|
LOG.debugf( "Statistics initialized [enabled=%s]", enabled );
|
||||||
return statistics;
|
return statistics;
|
||||||
|
|
|
@ -130,10 +130,10 @@ public class BasicOperationsTest {
|
||||||
String columnNamePattern = generateFinalNamePattern( meta, columnName );
|
String columnNamePattern = generateFinalNamePattern( meta, columnName );
|
||||||
|
|
||||||
ResultSet columnInfo = meta.getColumns( null, null, tableNamePattern, columnNamePattern );
|
ResultSet columnInfo = meta.getColumns( null, null, tableNamePattern, columnNamePattern );
|
||||||
s.getJdbcCoordinator().getResourceRegistry().register( columnInfo, columnInfo.getStatement() );
|
s.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().register( columnInfo, columnInfo.getStatement() );
|
||||||
assertTrue( columnInfo.next() );
|
assertTrue( columnInfo.next() );
|
||||||
int dataType = columnInfo.getInt( "DATA_TYPE" );
|
int dataType = columnInfo.getInt( "DATA_TYPE" );
|
||||||
s.getJdbcCoordinator().getResourceRegistry().release( columnInfo, columnInfo.getStatement() );
|
s.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( columnInfo, columnInfo.getStatement() );
|
||||||
assertEquals(
|
assertEquals(
|
||||||
JdbcTypeNameMapper.getTypeName( expectedJdbcTypeCode ),
|
JdbcTypeNameMapper.getTypeName( expectedJdbcTypeCode ),
|
||||||
JdbcTypeNameMapper.getTypeName( dataType ),
|
JdbcTypeNameMapper.getTypeName( dataType ),
|
||||||
|
|
|
@ -94,8 +94,7 @@ public class QueryAndSQLTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNativeQueryWithFormulaAttribute(SessionFactoryScope scope) {
|
public void testNativeQueryWithFormulaAttribute(SessionFactoryScope scope) {
|
||||||
final String dateFunctionRendered = scope.getSessionFactory()
|
final String dateFunctionRendered = scope.getSessionFactory().getJdbcServices().getDialect()
|
||||||
.getDialect()
|
|
||||||
.currentDate();
|
.currentDate();
|
||||||
|
|
||||||
String sql = String.format(
|
String sql = String.format(
|
||||||
|
@ -129,8 +128,7 @@ public class QueryAndSQLTest {
|
||||||
public void testNativeQueryWithFormulaAttributeWithoutAlias(SessionFactoryScope scope) {
|
public void testNativeQueryWithFormulaAttributeWithoutAlias(SessionFactoryScope scope) {
|
||||||
scope.inTransaction(
|
scope.inTransaction(
|
||||||
session -> {
|
session -> {
|
||||||
String sql = "select TABLE_NAME , " + scope.getSessionFactory()
|
String sql = "select TABLE_NAME , " + scope.getSessionFactory().getJdbcServices().getDialect()
|
||||||
.getDialect()
|
|
||||||
.currentDate() + " as daysOld from ALL_TABLES where TABLE_NAME = 'AUDIT_ACTIONS' ";
|
.currentDate() + " as daysOld from ALL_TABLES where TABLE_NAME = 'AUDIT_ACTIONS' ";
|
||||||
session.createNativeQuery( sql ).addEntity( "t", AllTables.class ).list();
|
session.createNativeQuery( sql ).addEntity( "t", AllTables.class ).list();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,26 +48,26 @@ public class BatchTest extends BaseCoreFunctionalTestCase {
|
||||||
final int N = 5000; //26 secs with batch flush, 26 without
|
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 = 100000; //53 secs with batch flush, OOME without
|
||||||
//final int N = 250000; //137 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 );
|
doBatchInsertUpdate( N, batchSize );
|
||||||
System.out.println( System.currentTimeMillis() - start );
|
System.out.println( System.currentTimeMillis() - start );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatchInsertUpdateSizeEqJdbcBatchSize() {
|
public void testBatchInsertUpdateSizeEqJdbcBatchSize() {
|
||||||
int batchSize = sessionFactory().getSettings().getJdbcBatchSize();
|
int batchSize = sessionFactory().getSessionFactoryOptions().getJdbcBatchSize();
|
||||||
doBatchInsertUpdate( 50, batchSize );
|
doBatchInsertUpdate( 50, batchSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatchInsertUpdateSizeLtJdbcBatchSize() {
|
public void testBatchInsertUpdateSizeLtJdbcBatchSize() {
|
||||||
int batchSize = sessionFactory().getSettings().getJdbcBatchSize();
|
int batchSize = sessionFactory().getSessionFactoryOptions().getJdbcBatchSize();
|
||||||
doBatchInsertUpdate( 50, batchSize - 1 );
|
doBatchInsertUpdate( 50, batchSize - 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBatchInsertUpdateSizeGtJdbcBatchSize() {
|
public void testBatchInsertUpdateSizeGtJdbcBatchSize() {
|
||||||
int batchSize = sessionFactory().getSettings().getJdbcBatchSize();
|
int batchSize = sessionFactory().getSessionFactoryOptions().getJdbcBatchSize();
|
||||||
doBatchInsertUpdate( 50, batchSize + 1 );
|
doBatchInsertUpdate( 50, batchSize + 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -159,7 +159,7 @@ public class SQLExceptionConversionTest extends BaseCoreFunctionalTestCase {
|
||||||
private void releaseStatement(Session session, PreparedStatement ps) {
|
private void releaseStatement(Session session, PreparedStatement ps) {
|
||||||
if ( ps != null ) {
|
if ( ps != null ) {
|
||||||
try {
|
try {
|
||||||
( (SessionImplementor) session ).getJdbcCoordinator().getResourceRegistry().release( ps );
|
((SessionImplementor) session).getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( ps );
|
||||||
}
|
}
|
||||||
catch ( Throwable ignore ) {
|
catch ( Throwable ignore ) {
|
||||||
// ignore...
|
// ignore...
|
||||||
|
|
|
@ -9,10 +9,8 @@ package org.hibernate.orm.test.id;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.hibernate.Session;
|
import org.hibernate.Session;
|
||||||
import org.hibernate.Transaction;
|
|
||||||
import org.hibernate.boot.Metadata;
|
import org.hibernate.boot.Metadata;
|
||||||
import org.hibernate.boot.MetadataSources;
|
import org.hibernate.boot.MetadataSources;
|
||||||
import org.hibernate.boot.model.naming.ObjectNameNormalizer;
|
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||||
|
@ -82,7 +80,7 @@ public class SequenceStyleGeneratorBehavesLikeSequeceHiloGeneratorWitZeroIncreme
|
||||||
|
|
||||||
sessionFactory = (SessionFactoryImplementor) metadata.buildSessionFactory();
|
sessionFactory = (SessionFactoryImplementor) metadata.buildSessionFactory();
|
||||||
generator.initialize( sessionFactory.getSqlStringGenerationContext() );
|
generator.initialize( sessionFactory.getSqlStringGenerationContext() );
|
||||||
sequenceValueExtractor = new SequenceValueExtractor( sessionFactory.getDialect(), TEST_SEQUENCE );
|
sequenceValueExtractor = new SequenceValueExtractor(sessionFactory.getJdbcServices().getDialect(), TEST_SEQUENCE );
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterEach
|
@AfterEach
|
||||||
|
|
|
@ -154,7 +154,7 @@ public class GeneralWorkTest extends BaseCoreFunctionalTestCase {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
s.getJdbcCoordinator().getResourceRegistry().release( statement );
|
s.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( statement );
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
// ignore
|
// ignore
|
||||||
|
@ -166,7 +166,7 @@ public class GeneralWorkTest extends BaseCoreFunctionalTestCase {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
s.getJdbcCoordinator().getResourceRegistry().release( resultSet, statement );
|
s.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( resultSet, statement );
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
// ignore
|
// ignore
|
||||||
|
|
|
@ -131,7 +131,7 @@ public class AggressiveReleaseTest extends BaseSessionFactoryFunctionalTest {
|
||||||
ps.setLong( 1, 1 );
|
ps.setLong( 1, 1 );
|
||||||
ps.setString( 2, "name" );
|
ps.setString( 2, "name" );
|
||||||
jdbcCoord.getResultSetReturn().execute( ps );
|
jdbcCoord.getResultSetReturn().execute( ps );
|
||||||
assertTrue( jdbcCoord.getResourceRegistry().hasRegisteredResources() );
|
assertTrue( jdbcCoord.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
assertEquals( 1, connectionProvider.getAcquiredConnections().size() );
|
assertEquals( 1, connectionProvider.getAcquiredConnections().size() );
|
||||||
assertEquals( 0, connectionProvider.getReleasedConnections().size() );
|
assertEquals( 0, connectionProvider.getReleasedConnections().size() );
|
||||||
resourceRegistry.release( ps );
|
resourceRegistry.release( ps );
|
||||||
|
|
|
@ -106,6 +106,6 @@ public class BasicConnectionTest extends BaseCoreFunctionalTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ResourceRegistry getResourceRegistry(JdbcCoordinator jdbcCoord) {
|
private ResourceRegistry getResourceRegistry(JdbcCoordinator jdbcCoord) {
|
||||||
return jdbcCoord.getResourceRegistry();
|
return jdbcCoord.getLogicalConnection().getResourceRegistry();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
// 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) )" );
|
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() );
|
assertTrue( logicalConnection.isPhysicallyConnected() );
|
||||||
jdbcCoordinator.getResourceRegistry().release( statement );
|
jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( statement );
|
||||||
assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() );
|
assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
assertTrue( logicalConnection.isPhysicallyConnected() ); // after_transaction specified
|
assertTrue( logicalConnection.isPhysicallyConnected() ); // after_transaction specified
|
||||||
|
|
||||||
// ok, now we can get down to it...
|
// ok, now we can get down to it...
|
||||||
|
@ -94,12 +94,12 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey
|
||||||
insertBatch.addToBatch();
|
insertBatch.addToBatch();
|
||||||
assertEquals( 0, batchObserver.getExplicitExecutionCount() );
|
assertEquals( 0, batchObserver.getExplicitExecutionCount() );
|
||||||
assertEquals( 1, batchObserver.getImplicitExecutionCount() );
|
assertEquals( 1, batchObserver.getImplicitExecutionCount() );
|
||||||
assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() );
|
assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
|
|
||||||
insertBatch.execute();
|
insertBatch.execute();
|
||||||
assertEquals( 1, batchObserver.getExplicitExecutionCount() );
|
assertEquals( 1, batchObserver.getExplicitExecutionCount() );
|
||||||
assertEquals( 1, batchObserver.getImplicitExecutionCount() );
|
assertEquals( 1, batchObserver.getImplicitExecutionCount() );
|
||||||
assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() );
|
assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
|
|
||||||
insertBatch.release();
|
insertBatch.release();
|
||||||
|
|
||||||
|
@ -124,10 +124,10 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey
|
||||||
catch ( Exception e ) {
|
catch ( Exception e ) {
|
||||||
// ignore if the DB doesn't support "if exists" and the table doesn't exist
|
// 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) )" );
|
} 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() );
|
assertTrue( logicalConnection.isPhysicallyConnected() );
|
||||||
jdbcCoordinator.getResourceRegistry().release( statement );
|
jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( statement );
|
||||||
assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() );
|
assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
assertTrue( logicalConnection.isPhysicallyConnected() ); // after_transaction specified
|
assertTrue( logicalConnection.isPhysicallyConnected() ); // after_transaction specified
|
||||||
|
|
||||||
// ok, now we can get down to it...
|
// ok, now we can get down to it...
|
||||||
|
@ -152,7 +152,7 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey
|
||||||
insertBatch.addToBatch();
|
insertBatch.addToBatch();
|
||||||
assertEquals( 0, batchObserver.getExplicitExecutionCount() );
|
assertEquals( 0, batchObserver.getExplicitExecutionCount() );
|
||||||
assertEquals( 0, batchObserver.getImplicitExecutionCount() );
|
assertEquals( 0, batchObserver.getImplicitExecutionCount() );
|
||||||
assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() );
|
assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
|
|
||||||
PreparedStatement insert2 = insertBatch.getBatchStatement( insertSql, false );
|
PreparedStatement insert2 = insertBatch.getBatchStatement( insertSql, false );
|
||||||
assertSame( insert, insert2 );
|
assertSame( insert, insert2 );
|
||||||
|
@ -164,12 +164,12 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey
|
||||||
insertBatch.addToBatch();
|
insertBatch.addToBatch();
|
||||||
assertEquals( 0, batchObserver.getExplicitExecutionCount() );
|
assertEquals( 0, batchObserver.getExplicitExecutionCount() );
|
||||||
assertEquals( 1, batchObserver.getImplicitExecutionCount() );
|
assertEquals( 1, batchObserver.getImplicitExecutionCount() );
|
||||||
assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() );
|
assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
|
|
||||||
insertBatch.execute();
|
insertBatch.execute();
|
||||||
assertEquals( 1, batchObserver.getExplicitExecutionCount() );
|
assertEquals( 1, batchObserver.getExplicitExecutionCount() );
|
||||||
assertEquals( 1, batchObserver.getImplicitExecutionCount() );
|
assertEquals( 1, batchObserver.getImplicitExecutionCount() );
|
||||||
assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() );
|
assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
|
|
||||||
insertBatch.release();
|
insertBatch.release();
|
||||||
|
|
||||||
|
@ -195,10 +195,10 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey
|
||||||
catch ( Exception e ) {
|
catch ( Exception e ) {
|
||||||
// ignore if the DB doesn't support "if exists" and the table doesn't exist
|
// 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) )" );
|
} 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() );
|
assertTrue( logicalConnection.isPhysicallyConnected() );
|
||||||
jdbcCoordinator.getResourceRegistry().release( statement );
|
jdbcCoordinator.getLogicalConnection().getResourceRegistry().release( statement );
|
||||||
assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() );
|
assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
assertTrue( logicalConnection.isPhysicallyConnected() ); // after_transaction specified
|
assertTrue( logicalConnection.isPhysicallyConnected() ); // after_transaction specified
|
||||||
|
|
||||||
// ok, now we can get down to it...
|
// ok, now we can get down to it...
|
||||||
|
@ -223,7 +223,7 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey
|
||||||
insertBatch.addToBatch();
|
insertBatch.addToBatch();
|
||||||
assertEquals( 0, batchObserver.getExplicitExecutionCount() );
|
assertEquals( 0, batchObserver.getExplicitExecutionCount() );
|
||||||
assertEquals( 0, batchObserver.getImplicitExecutionCount() );
|
assertEquals( 0, batchObserver.getImplicitExecutionCount() );
|
||||||
assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() );
|
assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
|
|
||||||
PreparedStatement insert2 = insertBatch.getBatchStatement( insertSql, false );
|
PreparedStatement insert2 = insertBatch.getBatchStatement( insertSql, false );
|
||||||
assertSame( insert, insert2 );
|
assertSame( insert, insert2 );
|
||||||
|
@ -235,7 +235,7 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey
|
||||||
insertBatch.addToBatch();
|
insertBatch.addToBatch();
|
||||||
assertEquals( 0, batchObserver.getExplicitExecutionCount() );
|
assertEquals( 0, batchObserver.getExplicitExecutionCount() );
|
||||||
assertEquals( 0, batchObserver.getImplicitExecutionCount() );
|
assertEquals( 0, batchObserver.getImplicitExecutionCount() );
|
||||||
assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() );
|
assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
|
|
||||||
PreparedStatement insert3 = insertBatch.getBatchStatement( insertSql, false );
|
PreparedStatement insert3 = insertBatch.getBatchStatement( insertSql, false );
|
||||||
assertSame( insert, insert3 );
|
assertSame( insert, insert3 );
|
||||||
|
@ -247,12 +247,12 @@ public class BatchingTest extends BaseCoreFunctionalTestCase implements BatchKey
|
||||||
insertBatch.addToBatch();
|
insertBatch.addToBatch();
|
||||||
assertEquals( 0, batchObserver.getExplicitExecutionCount() );
|
assertEquals( 0, batchObserver.getExplicitExecutionCount() );
|
||||||
assertEquals( 1, batchObserver.getImplicitExecutionCount() );
|
assertEquals( 1, batchObserver.getImplicitExecutionCount() );
|
||||||
assertTrue( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() );
|
assertTrue( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
|
|
||||||
insertBatch.execute();
|
insertBatch.execute();
|
||||||
assertEquals( 1, batchObserver.getExplicitExecutionCount() );
|
assertEquals( 1, batchObserver.getExplicitExecutionCount() );
|
||||||
assertEquals( 1, batchObserver.getImplicitExecutionCount() );
|
assertEquals( 1, batchObserver.getImplicitExecutionCount() );
|
||||||
assertFalse( jdbcCoordinator.getResourceRegistry().hasRegisteredResources() );
|
assertFalse( jdbcCoordinator.getLogicalConnection().getResourceRegistry().hasRegisteredResources() );
|
||||||
|
|
||||||
insertBatch.release();
|
insertBatch.release();
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class MixedTest {
|
||||||
Long did = doc.getId();
|
Long did = doc.getId();
|
||||||
Long d2id = doc2.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" );
|
SkipLog.reportSkip( "database/driver does not support expected LOB usage pattern", "LOB support" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class RowIdTest2 {
|
||||||
st,
|
st,
|
||||||
"create table Point (\"x\" number(19,2) not null, \"y\" number(19,2) not null, description varchar2(255) )"
|
"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 );
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -58,10 +58,9 @@ public class SessionWithSharedConnectionTest {
|
||||||
// secondSession.createCriteria( IrrelevantEntity.class ).list();
|
// secondSession.createCriteria( IrrelevantEntity.class ).list();
|
||||||
|
|
||||||
//the list should have registered and then released a JDBC resource
|
//the list should have registered and then released a JDBC resource
|
||||||
assertFalse(
|
assertFalse(
|
||||||
((SessionImplementor) secondSession)
|
((SessionImplementor) secondSession)
|
||||||
.getJdbcCoordinator()
|
.getJdbcCoordinator().getLogicalConnection().getResourceRegistry()
|
||||||
.getResourceRegistry()
|
|
||||||
.hasRegisteredResources()
|
.hasRegisteredResources()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static org.hibernate.testing.junit4.ExtraAssertions.assertTyping;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -129,8 +128,8 @@ public class AutoDiscoveryTest extends BaseCoreFunctionalTestCase {
|
||||||
Assert.assertFalse( "bad dialect.getColumnAliasExtractor impl", column1Alias.equals( column2Alias ) );
|
Assert.assertFalse( "bad dialect.getColumnAliasExtractor impl", column1Alias.equals( column2Alias ) );
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
sessionImplementor.getJdbcCoordinator().getResourceRegistry().release( rs, ps );
|
sessionImplementor.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( rs, ps );
|
||||||
sessionImplementor.getJdbcCoordinator().getResourceRegistry().release( ps );
|
sessionImplementor.getJdbcCoordinator().getLogicalConnection().getResourceRegistry().release( ps );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class TimePropertyTest {
|
||||||
|
|
||||||
final String queryString;
|
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 )";
|
queryString = "from TimePropertyTest$Entity where tAsDate = cast ( ?1 as time )";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -65,7 +65,7 @@ public class ResultTransformerTest {
|
||||||
ScrollableResults sr = q.scroll();
|
ScrollableResults sr = q.scroll();
|
||||||
// HANA supports only ResultSet.TYPE_FORWARD_ONLY and
|
// HANA supports only ResultSet.TYPE_FORWARD_ONLY and
|
||||||
// does not support java.sql.ResultSet.first()
|
// does not support java.sql.ResultSet.first()
|
||||||
if ( scope.getSessionFactory().getDialect() instanceof AbstractHANADialect ) {
|
if ( scope.getSessionFactory().getJdbcServices().getDialect() instanceof AbstractHANADialect ) {
|
||||||
sr.next();
|
sr.next();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue