From 37703e2e4cf454cfcfb258718423a841f9a174eb Mon Sep 17 00:00:00 2001 From: Jan Schatteman Date: Mon, 15 Nov 2021 23:03:16 +0100 Subject: [PATCH] Remove deprecated properties from AvailableSettings (#4362) * Remove deprecated ACQUIRE_CONNECTIONS and RELEASE_CONNECTIONS from AvailableSettings Signed-off-by: Jan Schatteman * Remove deprecated PROXOOL_PREFIX and PREFER_POOLED_VALUES_LO from AvailableSettings Signed-off-by: Jan Schatteman --- .../userguide/appendices/Configurations.adoc | 22 -------- .../hibernate/boot/SessionFactoryBuilder.java | 3 +- .../SessionFactoryOptionsBuilder.java | 48 ----------------- .../org/hibernate/cfg/AvailableSettings.java | 41 --------------- .../jdbc/internal/JdbcCoordinatorImpl.java | 9 ++-- .../engine/jdbc/spi/JdbcCoordinator.java | 24 --------- .../id/enhanced/OptimizerFactory.java | 51 +------------------ .../internal/JdbcSessionContextImpl.java | 10 ---- .../internal/log/DeprecationLogger.java | 8 --- .../org/hibernate/mapping/SimpleValue.java | 4 -- .../resource/jdbc/spi/JdbcSessionContext.java | 14 ----- .../spi/TransactionCoordinatorBuilder.java | 18 ------- .../connections/AggressiveReleaseTest.java | 4 +- .../BasicConnectionProviderTest.java | 4 +- .../connections/SuppliedConnectionTest.java | 4 +- .../enhanced/SequenceStyleConfigUnitTest.java | 2 +- .../ConfigurationValidationTest.java | 4 +- .../java/org/hibernate/test/tm/CMTTest.java | 4 +- 18 files changed, 19 insertions(+), 255 deletions(-) diff --git a/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc b/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc index 76b7473942..b95033ca3d 100644 --- a/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc +++ b/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc @@ -131,8 +131,6 @@ Doing so will lead to Hibernate executing SQL operations outside of any JDBC/SQL `*hibernate.connection.handling_mode*`:: Specifies how Hibernate should manage JDBC connections in terms of acquiring and releasing. -This configuration property supersedes `*hibernate.connection.acquisition_mode*` and -`*hibernate.connection.release_mode*`. + The connection handling mode strategies are defined by the https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/resource/jdbc/spi/PhysicalConnectionHandlingMode.html[`PhysicalConnectionHandlingMode`] enumeration. @@ -142,26 +140,6 @@ The configuration can be either a `PhysicalConnectionHandlingMode` reference or For more details about the `PhysicalConnectionHandlingMode` and Hibernate connection handling, check out the <> section. -[line-through]#`*hibernate.connection.acquisition_mode*`# (e.g. `immediate`):: -[NOTE] -==== -This setting is deprecated. You should use the `*hibernate.connection.handling_mode*` instead. -==== - -Specifies how Hibernate should acquire JDBC connections. The possible values are given by `org.hibernate.ConnectionAcquisitionMode`. - -Should generally only configure this or `hibernate.connection.release_mode`, not both. - -[line-through]#`*hibernate.connection.release_mode*`# (e.g. `auto` (default value)):: -[NOTE] -==== -This setting is deprecated. You should use the `*hibernate.connection.handling_mode*` instead. -==== - -Specifies how Hibernate should release JDBC connections. The possible values are given by the current transaction mode (`after_transaction` for JDBC transactions and `after_statement` for JTA transactions). - -Should generally only configure this or `hibernate.connection.acquisition_mode`, not both. - `*hibernate.connection.datasource*`:: Either a `javax.sql.DataSource` instance or a JNDI name under which to locate the `DataSource`. + diff --git a/hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java b/hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java index 47bdb69cb8..ec1814e52f 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/SessionFactoryBuilder.java @@ -646,8 +646,7 @@ public interface SessionFactoryBuilder { * * @return {@code this}, for method chaining * - * @see org.hibernate.cfg.AvailableSettings#ACQUIRE_CONNECTIONS - * @see org.hibernate.cfg.AvailableSettings#RELEASE_CONNECTIONS + * @see org.hibernate.cfg.AvailableSettings#CONNECTION_HANDLING * @see org.hibernate.ConnectionAcquisitionMode * @see ConnectionReleaseMode */ diff --git a/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java b/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java index 3255e5b012..7cbc10107a 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/internal/SessionFactoryOptionsBuilder.java @@ -78,7 +78,6 @@ import org.hibernate.type.FormatMapper; import org.hibernate.type.JacksonJsonFormatMapper; import org.hibernate.type.JsonBJsonFormatMapper; -import static org.hibernate.cfg.AvailableSettings.ACQUIRE_CONNECTIONS; import static org.hibernate.cfg.AvailableSettings.ALLOW_JTA_TRANSACTION_ACCESS; import static org.hibernate.cfg.AvailableSettings.ALLOW_REFRESH_DETACHED_ENTITY; import static org.hibernate.cfg.AvailableSettings.ALLOW_UPDATE_OUTSIDE_TRANSACTION; @@ -119,7 +118,6 @@ import static org.hibernate.cfg.AvailableSettings.QUERY_CACHE_FACTORY; import static org.hibernate.cfg.AvailableSettings.QUERY_STARTUP_CHECKING; import static org.hibernate.cfg.AvailableSettings.QUERY_STATISTICS_MAX_SIZE; import static org.hibernate.cfg.AvailableSettings.QUERY_SUBSTITUTIONS; -import static org.hibernate.cfg.AvailableSettings.RELEASE_CONNECTIONS; import static org.hibernate.cfg.AvailableSettings.SESSION_FACTORY_NAME; import static org.hibernate.cfg.AvailableSettings.SESSION_FACTORY_NAME_IS_JNDI; import static org.hibernate.cfg.AvailableSettings.SESSION_SCOPED_INTERCEPTOR; @@ -744,7 +742,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { }; } - @SuppressWarnings("deprecation") private PhysicalConnectionHandlingMode interpretConnectionHandlingMode( Map configurationSettings, StandardServiceRegistry serviceRegistry) { @@ -756,55 +753,10 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions { return specifiedHandlingMode; } - final TransactionCoordinatorBuilder transactionCoordinatorBuilder = serviceRegistry.getService( TransactionCoordinatorBuilder.class ); - - // see if the deprecated ConnectionAcquisitionMode/ConnectionReleaseMode were used.. - final ConnectionAcquisitionMode specifiedAcquisitionMode = ConnectionAcquisitionMode.interpret( - configurationSettings.get( ACQUIRE_CONNECTIONS ) - ); - final ConnectionReleaseMode specifiedReleaseMode = ConnectionReleaseMode.interpret( - configurationSettings.get( RELEASE_CONNECTIONS ) - ); - if ( specifiedAcquisitionMode != null || specifiedReleaseMode != null ) { - return interpretConnectionHandlingMode( specifiedAcquisitionMode, specifiedReleaseMode, configurationSettings, transactionCoordinatorBuilder ); - } - return transactionCoordinatorBuilder.getDefaultConnectionHandlingMode(); } - @SuppressWarnings("deprecation") - private PhysicalConnectionHandlingMode interpretConnectionHandlingMode( - ConnectionAcquisitionMode specifiedAcquisitionMode, - ConnectionReleaseMode specifiedReleaseMode, - Map configurationSettings, - TransactionCoordinatorBuilder transactionCoordinatorBuilder) { - DEPRECATION_LOGGER.logUseOfDeprecatedConnectionHandlingSettings(); - - final ConnectionAcquisitionMode effectiveAcquisitionMode = specifiedAcquisitionMode == null - ? ConnectionAcquisitionMode.AS_NEEDED - : specifiedAcquisitionMode; - - final ConnectionReleaseMode effectiveReleaseMode; - if ( specifiedReleaseMode == null ) { - // check the actual setting. If we get in here it *should* be "auto" or null - final String releaseModeName = ConfigurationHelper.getString( RELEASE_CONNECTIONS, configurationSettings, "auto" ); - assert "auto".equalsIgnoreCase( releaseModeName ); - // nothing was specified (or someone happened to configure the "magic" value) - if ( effectiveAcquisitionMode == ConnectionAcquisitionMode.IMMEDIATELY ) { - effectiveReleaseMode = ConnectionReleaseMode.ON_CLOSE; - } - else { - effectiveReleaseMode = transactionCoordinatorBuilder.getDefaultConnectionReleaseMode(); - } - } - else { - effectiveReleaseMode = specifiedReleaseMode; - } - - return PhysicalConnectionHandlingMode.interpret( effectiveAcquisitionMode, effectiveReleaseMode ); - } - private static FormatMapper determineJsonFormatMapper(Object setting, StrategySelector strategySelector) { return strategySelector.resolveDefaultableStrategy( FormatMapper.class, diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java index 3534d2a4c7..f85d6ca494 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/AvailableSettings.java @@ -853,33 +853,8 @@ public interface AvailableSettings { */ String FLUSH_BEFORE_COMPLETION = "hibernate.transaction.flush_before_completion"; - /** - * Specifies how Hibernate should acquire JDBC connections. Should generally only configure - * this or {@link #RELEASE_CONNECTIONS}, not both - * - * @see org.hibernate.ConnectionAcquisitionMode - * - * @since 5.1 - * - * @deprecated (since 5.2) use {@link #CONNECTION_HANDLING} instead - */ - @Deprecated - String ACQUIRE_CONNECTIONS = "hibernate.connection.acquisition_mode"; - - /** - * Specifies how Hibernate should release JDBC connections. Should generally only configure - * this or {@link #ACQUIRE_CONNECTIONS}, not both - * - * @see org.hibernate.ConnectionReleaseMode - * - * @deprecated (since 5.2) use {@link #CONNECTION_HANDLING} instead - */ - @Deprecated - String RELEASE_CONNECTIONS = "hibernate.connection.release_mode"; - /** * Specifies how Hibernate should manage JDBC connections in terms of acquiring and releasing. - * Supersedes {@link #ACQUIRE_CONNECTIONS} and {@link #RELEASE_CONNECTIONS} * * @see org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode * @@ -1182,13 +1157,6 @@ public interface AvailableSettings { */ String PROXOOL_CONFIG_PREFIX = "hibernate.proxool"; - /** - * Proxool/Hibernate property prefix - * @deprecated Use {@link #PROXOOL_CONFIG_PREFIX} instead - */ - @Deprecated - String PROXOOL_PREFIX = PROXOOL_CONFIG_PREFIX; - /** * Proxool property to configure the Proxool Provider using an XML (/path/to/file.xml) */ @@ -1328,15 +1296,6 @@ public interface AvailableSettings { String JPAQL_STRICT_COMPLIANCE= "hibernate.query.jpaql_strict_compliance"; - /** - * When using pooled {@link org.hibernate.id.enhanced.Optimizer optimizers}, prefer interpreting the - * database value as the lower (lo) boundary. The default is to interpret it as the high boundary. - * - * @deprecated Use {@link #PREFERRED_POOLED_OPTIMIZER} instead - */ - @Deprecated - String PREFER_POOLED_VALUES_LO = "hibernate.id.optimizer.pooled.prefer_lo"; - /** * When a generator specified an increment-size and an optimizer was not explicitly specified, which of * the "pooled" optimizers should be preferred? Can specify an optimizer short name or an Optimizer 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 c1ca817ce8..44156e403d 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 @@ -247,7 +247,7 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator { @Override public void afterStatementExecution() { - final ConnectionReleaseMode connectionReleaseMode = getConnectionReleaseMode(); + final ConnectionReleaseMode connectionReleaseMode = getLogicalConnection().getConnectionHandlingMode().getReleaseMode(); LOG.tracev( "Starting after statement execution processing [{0}]", connectionReleaseMode ); if ( connectionReleaseMode == ConnectionReleaseMode.AFTER_STATEMENT ) { if ( ! releasesEnabled ) { @@ -265,9 +265,10 @@ public class JdbcCoordinatorImpl implements JdbcCoordinator { @Override public void afterTransaction() { transactionTimeOutInstant = -1; - if ( getConnectionReleaseMode() == ConnectionReleaseMode.AFTER_STATEMENT || - getConnectionReleaseMode() == ConnectionReleaseMode.AFTER_TRANSACTION || - getConnectionReleaseMode() == ConnectionReleaseMode.BEFORE_TRANSACTION_COMPLETION ) { + ConnectionReleaseMode connectionReleaseMode = getLogicalConnection().getConnectionHandlingMode().getReleaseMode(); + if ( connectionReleaseMode == ConnectionReleaseMode.AFTER_STATEMENT || + connectionReleaseMode == ConnectionReleaseMode.AFTER_TRANSACTION || + connectionReleaseMode == ConnectionReleaseMode.BEFORE_TRANSACTION_COMPLETION ) { this.logicalConnection.afterTransaction(); } } 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 07b4b2a5a0..2b9c4e39ea 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 @@ -161,30 +161,6 @@ public interface JdbcCoordinator extends Serializable, TransactionCoordinatorOwn */ boolean isReadyForSerialization(); - /** - * The release mode under which this logical connection is operating. - * - * @return the release mode. - * - * @deprecated (since 5.2) use {@link PhysicalConnectionHandlingMode} via {@link #getLogicalConnection} instead - */ - @Deprecated - default ConnectionReleaseMode getConnectionReleaseMode() { - return getLogicalConnection().getConnectionHandlingMode().getReleaseMode(); - } - - /** - * The mode for physical handling of the JDBC Connection - * - * @return The JDBC Connection handlng mode - * - * @deprecated (since 5.2) access via {@link #getLogicalConnection} instead - */ - @Deprecated - default PhysicalConnectionHandlingMode getConnectionHandlingMode() { - return getLogicalConnection().getConnectionHandlingMode(); - } - /** * @deprecated (since 5.2) access via {@link #getLogicalConnection} instead */ diff --git a/hibernate-core/src/main/java/org/hibernate/id/enhanced/OptimizerFactory.java b/hibernate-core/src/main/java/org/hibernate/id/enhanced/OptimizerFactory.java index 8d248165d1..7adb3ffd7e 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/enhanced/OptimizerFactory.java +++ b/hibernate-core/src/main/java/org/hibernate/id/enhanced/OptimizerFactory.java @@ -104,51 +104,6 @@ public class OptimizerFactory { return optimizer; } - /** - * Deprecated! - * - * @deprecated Use {@link StandardOptimizerDescriptor#getExternalName()} via {@link StandardOptimizerDescriptor#NONE} - */ - @Deprecated - @SuppressWarnings( {"UnusedDeclaration"}) - public static final String NONE = StandardOptimizerDescriptor.NONE.getExternalName(); - - /** - * Deprecated! - * - * @deprecated Use {@link StandardOptimizerDescriptor#getExternalName()} via {@link StandardOptimizerDescriptor#HILO} - */ - @Deprecated - @SuppressWarnings( {"UnusedDeclaration"}) - public static final String HILO = StandardOptimizerDescriptor.HILO.getExternalName(); - - /** - * Deprecated! - * - * @deprecated Use {@link StandardOptimizerDescriptor#getExternalName()} via {@link StandardOptimizerDescriptor#LEGACY_HILO} - */ - @Deprecated - @SuppressWarnings( {"UnusedDeclaration"}) - public static final String LEGACY_HILO = "legacy-hilo"; - - /** - * Deprecated! - * - * @deprecated Use {@link StandardOptimizerDescriptor#getExternalName()} via {@link StandardOptimizerDescriptor#POOLED} - */ - @Deprecated - @SuppressWarnings( {"UnusedDeclaration"}) - public static final String POOL = "pooled"; - - /** - * Deprecated! - * - * @deprecated Use {@link StandardOptimizerDescriptor#getExternalName()} via {@link StandardOptimizerDescriptor#POOLED_LO} - */ - @Deprecated - @SuppressWarnings( {"UnusedDeclaration"}) - public static final String POOL_LO = "pooled-lo"; - /** * Determine the optimizer to use when there was not one explicitly specified. */ @@ -163,10 +118,8 @@ public class OptimizerFactory { return preferredPooledOptimizerStrategy; } - // otherwise fallback to the fallback strategy (considering the deprecated PREFER_POOLED_VALUES_LO setting) - return ConfigurationHelper.getBoolean( AvailableSettings.PREFER_POOLED_VALUES_LO, configSettings, false ) - ? StandardOptimizerDescriptor.POOLED_LO.getExternalName() - : StandardOptimizerDescriptor.POOLED.getExternalName(); + // otherwise fallback to the fallback strategy + return StandardOptimizerDescriptor.POOLED.getExternalName(); } private OptimizerFactory() { diff --git a/hibernate-core/src/main/java/org/hibernate/internal/JdbcSessionContextImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/JdbcSessionContextImpl.java index 36d16b05af..6aa7383a77 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/JdbcSessionContextImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/JdbcSessionContextImpl.java @@ -69,16 +69,6 @@ public class JdbcSessionContextImpl implements JdbcSessionContext { return settings().doesConnectionProviderDisableAutoCommit(); } - @Override - public ConnectionReleaseMode getConnectionReleaseMode() { - return connectionHandlingMode.getReleaseMode(); - } - - @Override - public ConnectionAcquisitionMode getConnectionAcquisitionMode() { - return connectionHandlingMode.getAcquisitionMode(); - } - @Override public StatementInspector getStatementInspector() { return statementInspector; diff --git a/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java index f4530c1cc1..1daf6106c4 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/log/DeprecationLogger.java @@ -224,14 +224,6 @@ public interface DeprecationLogger extends BasicLogger { ) void deprecatedLegacyCriteria(); - @LogMessage(level = WARN) - @Message( - id = 90000023, - value = "Encountered use of deprecated Connection handling settings [hibernate.connection.acquisition_mode]" + - "or [hibernate.connection.release_mode]; use [hibernate.connection.handling_mode] instead" - ) - void logUseOfDeprecatedConnectionHandlingSettings(); - @LogMessage(level = WARN) @Message( id = 90000024, diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java index b84dbdc0e9..9d3780d0b1 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java @@ -367,10 +367,6 @@ public abstract class SimpleValue implements KeyValue { final ConfigurationService cs = metadata.getMetadataBuildingOptions().getServiceRegistry() .getService( ConfigurationService.class ); - params.put( - AvailableSettings.PREFER_POOLED_VALUES_LO, - cs.getSetting( AvailableSettings.PREFER_POOLED_VALUES_LO, StandardConverters.BOOLEAN, false ) - ); params.put( IdentifierGenerator.CONTRIBUTOR_NAME, buildingContext.getCurrentContributorName() diff --git a/hibernate-core/src/main/java/org/hibernate/resource/jdbc/spi/JdbcSessionContext.java b/hibernate-core/src/main/java/org/hibernate/resource/jdbc/spi/JdbcSessionContext.java index 8116dd04ec..e0c90cf78f 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/jdbc/spi/JdbcSessionContext.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/jdbc/spi/JdbcSessionContext.java @@ -6,8 +6,6 @@ */ package org.hibernate.resource.jdbc.spi; -import org.hibernate.ConnectionAcquisitionMode; -import org.hibernate.ConnectionReleaseMode; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.service.ServiceRegistry; @@ -25,18 +23,6 @@ public interface JdbcSessionContext { boolean doesConnectionProviderDisableAutoCommit(); - /** - * @deprecated Use {@link #getPhysicalConnectionHandlingMode} instead - */ - @Deprecated - ConnectionReleaseMode getConnectionReleaseMode(); - - /** - * @deprecated Use {@link #getPhysicalConnectionHandlingMode} instead - */ - @Deprecated - ConnectionAcquisitionMode getConnectionAcquisitionMode(); - StatementInspector getStatementInspector(); JdbcObserver getObserver(); diff --git a/hibernate-core/src/main/java/org/hibernate/resource/transaction/spi/TransactionCoordinatorBuilder.java b/hibernate-core/src/main/java/org/hibernate/resource/transaction/spi/TransactionCoordinatorBuilder.java index e27af47551..a665605a5d 100644 --- a/hibernate-core/src/main/java/org/hibernate/resource/transaction/spi/TransactionCoordinatorBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/resource/transaction/spi/TransactionCoordinatorBuilder.java @@ -6,8 +6,6 @@ */ package org.hibernate.resource.transaction.spi; -import org.hibernate.ConnectionAcquisitionMode; -import org.hibernate.ConnectionReleaseMode; import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; import org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl; import org.hibernate.resource.transaction.backend.jta.internal.DdlTransactionIsolatorJtaImpl; @@ -40,22 +38,6 @@ public interface TransactionCoordinatorBuilder extends Service { PhysicalConnectionHandlingMode getDefaultConnectionHandlingMode(); - /** - * @deprecated (since 5.2) Use {@link #getDefaultConnectionHandlingMode} instead - */ - @Deprecated - default ConnectionAcquisitionMode getDefaultConnectionAcquisitionMode() { - return getDefaultConnectionHandlingMode().getAcquisitionMode(); - } - - /** - * @deprecated (since 5.2) Use {@link #getDefaultConnectionHandlingMode} instead - */ - @Deprecated - default ConnectionReleaseMode getDefaultConnectionReleaseMode() { - return getDefaultConnectionHandlingMode().getReleaseMode(); - } - default DdlTransactionIsolator buildDdlTransactionIsolator(JdbcContext jdbcContext) { return isJta() ? new DdlTransactionIsolatorJtaImpl( jdbcContext ) : new DdlTransactionIsolatorNonJtaImpl( jdbcContext ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/connections/AggressiveReleaseTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/connections/AggressiveReleaseTest.java index 6ee3b17cfc..5d8ef85042 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/connections/AggressiveReleaseTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/connections/AggressiveReleaseTest.java @@ -13,7 +13,6 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; -import org.hibernate.ConnectionReleaseMode; import org.hibernate.ScrollableResults; import org.hibernate.Session; import org.hibernate.cfg.AvailableSettings; @@ -21,6 +20,7 @@ import org.hibernate.cfg.Environment; import org.hibernate.dialect.H2Dialect; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.internal.util.SerializationHelper; +import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl; import org.hibernate.stat.Statistics; @@ -48,7 +48,7 @@ public class AggressiveReleaseTest extends ConnectionManagementTestCase { TestingJtaBootstrap.prepare( settings ); // settings.put( Environment.TRANSACTION_STRATEGY, CMTTransactionFactory.class.getName() ); settings.put( AvailableSettings.TRANSACTION_COORDINATOR_STRATEGY, JtaTransactionCoordinatorBuilderImpl.class.getName() ); - settings.put( Environment.RELEASE_CONNECTIONS, ConnectionReleaseMode.AFTER_STATEMENT.toString() ); + settings.put( Environment.CONNECTION_HANDLING, PhysicalConnectionHandlingMode.DELAYED_ACQUISITION_AND_RELEASE_AFTER_STATEMENT.toString() ); settings.put( Environment.GENERATE_STATISTICS, "true" ); settings.put( Environment.STATEMENT_BATCH_SIZE, "0" ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/connections/BasicConnectionProviderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/connections/BasicConnectionProviderTest.java index c85115d179..681f6328c7 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/connections/BasicConnectionProviderTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/connections/BasicConnectionProviderTest.java @@ -8,10 +8,10 @@ package org.hibernate.orm.test.connections; import java.util.Map; -import org.hibernate.ConnectionReleaseMode; import org.hibernate.Session; import org.hibernate.cfg.Environment; import org.hibernate.dialect.H2Dialect; +import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; import org.hibernate.testing.RequiresDialect; @@ -37,6 +37,6 @@ public class BasicConnectionProviderTest extends ConnectionManagementTestCase { @SuppressWarnings("unchecked") protected void addSettings(Map settings) { super.addSettings( settings ); - settings.put( Environment.RELEASE_CONNECTIONS, ConnectionReleaseMode.ON_CLOSE.toString() ); + settings.put( Environment.CONNECTION_HANDLING, PhysicalConnectionHandlingMode.DELAYED_ACQUISITION_AND_HOLD.toString() ); } } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/connections/SuppliedConnectionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/connections/SuppliedConnectionTest.java index 70f3c73fee..52ab9caaf6 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/connections/SuppliedConnectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/connections/SuppliedConnectionTest.java @@ -12,12 +12,12 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.Map; -import org.hibernate.ConnectionReleaseMode; import org.hibernate.Session; import org.hibernate.cfg.Environment; import org.hibernate.dialect.H2Dialect; import org.hibernate.engine.jdbc.connections.internal.UserSuppliedConnectionProviderImpl; import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; +import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; import org.hibernate.service.spi.Stoppable; import org.hibernate.tool.schema.internal.SchemaCreatorImpl; import org.hibernate.tool.schema.internal.SchemaDropperImpl; @@ -81,7 +81,7 @@ public class SuppliedConnectionTest extends ConnectionManagementTestCase { protected void addSettings(Map settings) { super.addSettings( settings ); - settings.put( Environment.RELEASE_CONNECTIONS, ConnectionReleaseMode.ON_CLOSE.toString() ); + settings.put( Environment.CONNECTION_HANDLING, PhysicalConnectionHandlingMode.DELAYED_ACQUISITION_AND_HOLD.toString() ); settings.put( Environment.CONNECTION_PROVIDER, UserSuppliedConnectionProviderImpl.class.getName() ); Connection connection; diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/id/enhanced/SequenceStyleConfigUnitTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/id/enhanced/SequenceStyleConfigUnitTest.java index 1f7a414885..f6d5d7da03 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/id/enhanced/SequenceStyleConfigUnitTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/id/enhanced/SequenceStyleConfigUnitTest.java @@ -348,7 +348,7 @@ public class SequenceStyleConfigUnitTest { assertClassAssignability( SequenceStructure.class, generator.getDatabaseStructure().getClass() ); assertClassAssignability( PooledOptimizer.class, generator.getOptimizer().getClass() ); - props.setProperty( Environment.PREFER_POOLED_VALUES_LO, "true" ); + props.setProperty( Environment.PREFERRED_POOLED_OPTIMIZER, StandardOptimizerDescriptor.POOLED_LO.getExternalName() ); generator = new SequenceStyleGenerator(); generator.configure( new TypeConfiguration().getBasicTypeRegistry() diff --git a/hibernate-core/src/test/java/org/hibernate/test/multitenancy/ConfigurationValidationTest.java b/hibernate-core/src/test/java/org/hibernate/test/multitenancy/ConfigurationValidationTest.java index 8d2ac39493..f7391c4837 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/multitenancy/ConfigurationValidationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/multitenancy/ConfigurationValidationTest.java @@ -6,12 +6,12 @@ */ package org.hibernate.test.multitenancy; -import org.hibernate.ConnectionReleaseMode; import org.hibernate.MultiTenancyStrategy; import org.hibernate.boot.MetadataSources; import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.cfg.Environment; import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider; +import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; import org.hibernate.service.spi.ServiceException; import org.hibernate.service.spi.ServiceRegistryImplementor; @@ -54,7 +54,7 @@ public class ConfigurationValidationTest extends BaseUnitTestCase { try { serviceRegistry = (ServiceRegistryImplementor) new StandardServiceRegistryBuilder() .applySetting( Environment.MULTI_TENANT, MultiTenancyStrategy.SCHEMA ) - .applySetting( Environment.RELEASE_CONNECTIONS, ConnectionReleaseMode.AFTER_STATEMENT.name() ) + .applySetting( Environment.CONNECTION_HANDLING, PhysicalConnectionHandlingMode.DELAYED_ACQUISITION_AND_RELEASE_AFTER_STATEMENT.name() ) .addService( MultiTenantConnectionProvider.class, new TestingConnectionProvider( diff --git a/hibernate-core/src/test/java/org/hibernate/test/tm/CMTTest.java b/hibernate-core/src/test/java/org/hibernate/test/tm/CMTTest.java index 7b9e314509..b0624db465 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/tm/CMTTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/tm/CMTTest.java @@ -10,11 +10,11 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.hibernate.ConnectionReleaseMode; import org.hibernate.ScrollableResults; import org.hibernate.Session; import org.hibernate.cfg.AvailableSettings; import org.hibernate.dialect.SQLServerDialect; +import org.hibernate.resource.jdbc.spi.PhysicalConnectionHandlingMode; import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl; import org.hibernate.testing.DialectChecks; @@ -49,7 +49,7 @@ public class CMTTest extends BaseNonConfigCoreFunctionalTestCase { settings.put( AvailableSettings.TRANSACTION_COORDINATOR_STRATEGY, JtaTransactionCoordinatorBuilderImpl.class.getName() ); settings.put( AvailableSettings.AUTO_CLOSE_SESSION, "true" ); settings.put( AvailableSettings.FLUSH_BEFORE_COMPLETION, "true" ); - settings.put( AvailableSettings.RELEASE_CONNECTIONS, ConnectionReleaseMode.AFTER_STATEMENT.toString() ); + settings.put( AvailableSettings.CONNECTION_HANDLING, PhysicalConnectionHandlingMode.DELAYED_ACQUISITION_AND_RELEASE_AFTER_STATEMENT.toString() ); settings.put( AvailableSettings.GENERATE_STATISTICS, "true" ); settings.put( AvailableSettings.USE_QUERY_CACHE, "true" ); settings.put( AvailableSettings.CACHE_REGION_PREFIX, "" );