remove some legacy config properties

the following are gone:

hibernate.ejb.resource_scanner
hibernate.query.substitutions
hibernate.jdbc.sql_exception_converter
hibernate.native_exception_handling_51_compliance
hibernate.legacy_limit_handler
hibernate.jdbc.wrap_result_sets
This commit is contained in:
Gavin King 2022-01-20 16:43:25 +01:00
parent dded606259
commit e7acffef15
24 changed files with 91 additions and 446 deletions

View File

@ -464,9 +464,6 @@ Defines precedence of null values in `ORDER BY` clause. Defaults to `none` which
`*hibernate.discriminator.force_in_select*` (e.g. `true` or `false` (default value))::
For entities which do not explicitly say, should we force discriminators into SQL selects?
`*hibernate.query.substitutions*` (e.g. `true=1,false=0`)::
A comma-separated list of token substitutions to use when translating a Hibernate query to SQL.
`*hibernate.query.factory_class*` (e.g. `org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory` (default value) or `org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory`)::
Chooses the HQL parser implementation.
@ -571,13 +568,6 @@ It follows a pattern similar to the ANSI SQL definition of the global temporary
+
This configuration property defines the database catalog used for storing the temporary tables used for bulk HQL operations.
`*hibernate.legacy_limit_handler*` (e.g. `true` or `false` (default value))::
Setting which indicates whether or not to use `org.hibernate.dialect.pagination.LimitHandler`
implementations that sacrifices performance optimizations to allow legacy 4.x limit behavior.
+
Legacy 4.x behavior favored performing pagination in-memory by avoiding the use of the offset value, which is overall poor performance.
In 5.x, the limit handler behavior favors performance, thus, if the dialect doesn't support offsets, an exception is thrown instead.
`*hibernate.query.conventional_java_constants*` (e.g. `true` (default value) or `false`)::
Setting which indicates whether or not Java constants follow the https://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html[Java Naming conventions].
+
@ -634,9 +624,6 @@ Use streams when writing or reading `binary` or `serializable` types to or from
`*hibernate.jdbc.use_get_generated_keys*` (e.g. `true` or `false`)::
Allows Hibernate to use JDBC3 `PreparedStatement.getGeneratedKeys()` to retrieve natively-generated keys after insert. You need the JDBC3+ driver and JRE1.4+. Disable this property if your driver has problems with the Hibernate identifier generators. By default, it tries to detect the driver capabilities from connection metadata.
`*hibernate.jdbc.wrap_result_sets*` (e.g. `true` or `false` (default value))::
Enable wrapping of JDBC result sets in order to speed up column name lookups for broken JDBC drivers.
`*hibernate.enable_lazy_load_no_trans*` (e.g. `true` or `false` (default value))::
Initialize Lazy Proxies or Collections outside a given Transactional Persistence Context.
+
@ -708,11 +695,11 @@ Enables the automatic eviction of a bi-directional association's collection cach
`*hibernate.cache.use_reference_entries*` (e.g. `true` or `false`)::
Optimizes second-level cache operation to store immutable entities (aka "reference") which do not have associations into cache directly. In this case, disassembling and deep copy operations can be avoided. The default value of this property is `false`.
`*hibernate.ejb.classcache*` (e.g. `hibernate.ejb.classcache.org.hibernate.ejb.test.Item` = `read-write`)::
Sets the associated entity class cache concurrency strategy for the designated region. Caching configuration should follow the following pattern `hibernate.ejb.classcache.<fully.qualified.Classname> = usage[, region]` where usage is the cache strategy used and region the cache region name.
`*hibernate.classcache*` (e.g. `hibernate.classcache.org.hibernate.ejb.test.Item` = `read-write`)::
Sets the associated entity class cache concurrency strategy for the designated region. Caching configuration should follow the following pattern `hibernate.classcache.<fully.qualified.Classname> = usage[, region]` where usage is the cache strategy used and region the cache region name.
`*hibernate.ejb.collectioncache*` (e.g. `hibernate.ejb.collectioncache.org.hibernate.ejb.test.Item.distributors` = `read-write, RegionName`)::
Sets the associated collection cache concurrency strategy for the designated region. Caching configuration should follow the following pattern `hibernate.ejb.collectioncache.<fully.qualified.Classname>.<role> = usage[, region]` where usage is the cache strategy used and region the cache region name.
`*hibernate.collectioncache*` (e.g. `hibernate.collectioncache.org.hibernate.ejb.test.Item.distributors` = `read-write, RegionName`)::
Sets the associated collection cache concurrency strategy for the designated region. Caching configuration should follow the following pattern `hibernate.collectioncache.<fully.qualified.Classname>.<role> = usage[, region]` where usage is the cache strategy used and region the cache region name.
[[configurations-infinispan]]
=== Infinispan properties
@ -966,18 +953,6 @@ Defines the charset (encoding) used for all input/output schema generation resou
`*hibernate.hbm2ddl.halt_on_error*` (e.g. `true` or `false` (default value))::
Whether the schema migration tool should halt on error, therefore terminating the bootstrap process. By default, the `EntityManagerFactory` or `SessionFactory` are created even if the schema migration throws exceptions. To prevent this default behavior, set this property value to `true`.
[[configurations-exception-handling]]
=== Exception handling
`*hibernate.jdbc.sql_exception_converter*` (e.g. fully-qualified name of class implementing `SQLExceptionConverter`)::
The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/exception/spi/SQLExceptionConverter.html[`SQLExceptionConverter`] to use for converting `SQLExceptions` to Hibernate's `JDBCException` hierarchy. The default is to use the configured https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/dialect/Dialect.html[`Dialect`]'s preferred `SQLExceptionConverter`.
`*hibernate.native_exception_handling_51_compliance*` (e.g. `true` or `false` (default value))::
Indicates if exception handling for a `SessionFactory` built via Hibernate's native bootstrapping
should behave the same as native exception handling in Hibernate ORM 5.1. When set to `true`,
`HibernateException` will not be wrapped or converted according to the Jakarta Persistence specification. This
setting will be ignored for a `SessionFactory` built via Jakarta Persistence bootstrapping.
[[configurations-session-events]]
=== Session events

View File

@ -1403,9 +1403,6 @@ By default, the `SQLExceptionConverter` is defined by the configured Hibernate `
https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/dialect/Dialect.html#buildSQLExceptionConversionDelegate--[`buildSQLExceptionConversionDelegate`] method
which is overridden by several database-specific ``Dialect``s.
However, it is also possible to plug in a custom implementation. See the
<<appendices/Configurations.adoc#configurations-exception-handling,`hibernate.jdbc.sql_exception_converter`>> configuration property for more details.
The standard `JDBCException` subtypes are:
ConstraintViolationException::

View File

@ -9,11 +9,6 @@
### Query Language ###
######################
## define query language constants / function names
hibernate.query.substitutions yes 'Y', no 'N'
## select the classic query parser
#hibernate.query.factory_class org.hibernate.hql.internal.classic.ClassicQueryTranslatorFactory
@ -143,7 +138,6 @@ hibernate.connection.url jdbc:hsqldb:./build/db/hsqldb/hibernate
#hibernate.connection.url jdbc:sapdb://localhost/TST
#hibernate.connection.username TEST
#hibernate.connection.password TEST
#hibernate.query.substitutions yes 'Y', no 'N'
## MS SQL Server
@ -422,13 +416,6 @@ hibernate.jdbc.use_streams_for_binary true
## enable JDBC result set column alias caching
## (minor performance enhancement for broken JDBC drivers)
# hibernate.jdbc.wrap_result_sets
## choose a custom SQL exception converter
#hibernate.jdbc.sql_exception_converter
##########################

View File

@ -2,11 +2,6 @@
### Query Language ###
######################
## define query language constants / function names
hibernate.query.substitutions true 1, false 0, yes 'Y', no 'N'
## Query translator factory class
hibernate.query.factory_class @QUERY_TRANSLATOR_FACTORY@
@ -67,7 +62,6 @@ hibernate.connection.url @DB_URL@
#hibernate.connection.url jdbc:postgresql:template1
#hibernate.connection.username pg
#hibernate.connection.password
#hibernate.query.substitutions yes 'Y', no 'N'
## DB2
@ -126,7 +120,6 @@ hibernate.connection.url @DB_URL@
#hibernate.connection.url jdbc:sapdb://localhost/TST
#hibernate.connection.username TEST
#hibernate.connection.password TEST
#hibernate.query.substitutions yes 'Y', no 'N'
## MS SQL Server
@ -384,11 +377,6 @@ hibernate.jdbc.use_streams_for_binary true
# hibernate.jdbc.factory_class
## choose a custom SQL exception converter
#hibernate.jdbc.sql_exception_converter
##########################
### Second-level Cache ###

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.boot;
import java.util.Map;
import java.util.function.Supplier;
import org.hibernate.ConnectionReleaseMode;
@ -396,21 +395,6 @@ public interface SessionFactoryBuilder {
*/
SessionFactoryBuilder applyPreferUserTransactions(boolean preferUserTransactions);
/**
* Apply query substitutions to use in HQL queries. Note, this is a legacy feature and almost always
* never needed anymore...
*
* @param substitutions The substitution map
*
* @return {@code this}, for method chaining
*
* @see org.hibernate.cfg.AvailableSettings#QUERY_SUBSTITUTIONS
*
* @deprecated This is a legacy feature and should never be needed anymore...
*/
@Deprecated
SessionFactoryBuilder applyQuerySubstitutions(Map substitutions);
/**
* Should we strictly adhere to JPA Query Language (JPQL) syntax, or more broadly support
* all of Hibernate's superset (HQL)?
@ -596,21 +580,6 @@ public interface SessionFactoryBuilder {
*/
SessionFactoryBuilder applyScrollableResultsSupport(boolean enabled);
/**
* Hibernate currently accesses results from the JDBC ResultSet by name. This is known
* to be VERY slow on some drivers, especially older Oracle drivers. This setting
* allows Hibernate to wrap the ResultSet of the JDBC driver to manage the name->position
* resolution itself.
*
* @param enabled {@code true} indicates Hibernate should wrap result sets; {@code false} indicates
* it should not.
*
* @return {@code this}, for method chaining
*
* @see org.hibernate.cfg.AvailableSettings#WRAP_RESULT_SETS
*/
SessionFactoryBuilder applyResultSetsWrapping(boolean enabled);
/**
* Should JDBC {@link java.sql.PreparedStatement#getGeneratedKeys()} feature be used for
* retrieval of *insert-generated* ids?

View File

@ -101,12 +101,6 @@ public class BootstrapContextImpl implements BootstrapContext {
// ScanEnvironment must be set explicitly
this.scannerSetting = configService.getSettings().get( AvailableSettings.SCANNER );
if ( this.scannerSetting == null ) {
this.scannerSetting = configService.getSettings().get( AvailableSettings.SCANNER_DEPRECATED );
if ( this.scannerSetting != null ) {
DEPRECATION_LOGGER.logDeprecatedScannerSetting();
}
}
this.archiveDescriptorFactory = strategySelector.resolveStrategy(
ArchiveDescriptorFactory.class,
configService.getSettings().get( AvailableSettings.SCANNER_ARCHIVE_INTERPRETER )

View File

@ -261,12 +261,6 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
return this;
}
@Override
public SessionFactoryBuilder applyQuerySubstitutions(@SuppressWarnings("rawtypes") Map substitutions) {
this.optionsBuilder.applyQuerySubstitutions( substitutions );
return this;
}
@Override
public SessionFactoryBuilder applyNamedQueryCheckingOnStartup(boolean enabled) {
this.optionsBuilder.enableNamedQueryCheckingOnStartup( enabled );
@ -339,12 +333,6 @@ public class SessionFactoryBuilderImpl implements SessionFactoryBuilderImplement
return this;
}
@Override
public SessionFactoryBuilder applyResultSetsWrapping(boolean enabled) {
this.optionsBuilder.enableResultSetWrappingSupport( enabled );
return this;
}
@Override
public SessionFactoryBuilder applyGetGeneratedKeysSupport(boolean enabled) {
this.optionsBuilder.enableGeneratedKeysSupport( enabled );

View File

@ -111,7 +111,6 @@ import static org.hibernate.cfg.AvailableSettings.JTA_TRACK_BY_THREAD;
import static org.hibernate.cfg.AvailableSettings.LOG_SESSION_METRICS;
import static org.hibernate.cfg.AvailableSettings.MAX_FETCH_DEPTH;
import static org.hibernate.cfg.AvailableSettings.MULTI_TENANT_IDENTIFIER_RESOLVER;
import static org.hibernate.cfg.AvailableSettings.NATIVE_EXCEPTION_HANDLING_51_COMPLIANCE;
import static org.hibernate.cfg.AvailableSettings.OMIT_JOIN_OF_SUPERCLASS_TABLES;
import static org.hibernate.cfg.AvailableSettings.ORDER_INSERTS;
import static org.hibernate.cfg.AvailableSettings.ORDER_UPDATES;
@ -119,7 +118,6 @@ import static org.hibernate.cfg.AvailableSettings.PREFER_USER_TRANSACTION;
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.SESSION_FACTORY_NAME;
import static org.hibernate.cfg.AvailableSettings.SESSION_FACTORY_NAME_IS_JNDI;
import static org.hibernate.cfg.AvailableSettings.SESSION_SCOPED_INTERCEPTOR;
@ -136,7 +134,6 @@ import static org.hibernate.cfg.AvailableSettings.USE_SECOND_LEVEL_CACHE;
import static org.hibernate.cfg.AvailableSettings.USE_SQL_COMMENTS;
import static org.hibernate.cfg.AvailableSettings.USE_STRUCTURED_CACHE;
import static org.hibernate.cfg.AvailableSettings.VALIDATE_QUERY_PARAMETERS;
import static org.hibernate.cfg.AvailableSettings.WRAP_RESULT_SETS;
import static org.hibernate.engine.config.spi.StandardConverters.BOOLEAN;
import static org.hibernate.internal.CoreLogging.messageLogger;
import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
@ -222,7 +219,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
private SqmFunctionRegistry sqmFunctionRegistry;
private SqmTranslatorFactory sqmTranslatorFactory;
private Boolean useOfJdbcNamedParametersEnabled;
private Map querySubstitutions;
private boolean namedQueryStartupCheckingEnabled;
private boolean conventionalJavaConstants;
private final boolean omitJoinOfSuperclassTablesEnabled;
@ -251,7 +247,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
private boolean commentsEnabled;
private PhysicalConnectionHandlingMode connectionHandlingMode;
private boolean connectionProviderDisablesAutoCommit;
private boolean wrapResultSetsEnabled;
private TimeZone jdbcTimeZone;
private boolean queryParametersValidationEnabled;
private ValueHandlingMode criteriaValueHandlingMode;
@ -270,7 +265,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
private boolean failOnPaginationOverCollectionFetchEnabled;
private boolean inClauseParameterPaddingEnabled;
private boolean nativeExceptionHandling51Compliance;
private int queryStatisticsMaxSize;
@ -446,7 +440,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
this.useOfJdbcNamedParametersEnabled = cfgService.getSetting( CALLABLE_NAMED_PARAMS_ENABLED, BOOLEAN, true );
this.querySubstitutions = ConfigurationHelper.toMap( QUERY_SUBSTITUTIONS, " ,=;:\n\t\r\f", configurationSettings );
this.namedQueryStartupCheckingEnabled = cfgService.getSetting( QUERY_STARTUP_CHECKING, BOOLEAN, true );
this.conventionalJavaConstants = cfgService.getSetting(
CONVENTIONAL_JAVA_CONSTANTS, BOOLEAN, true );
@ -522,11 +515,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
configurationSettings,
meta.supportsScrollableResults()
);
this.wrapResultSetsEnabled = ConfigurationHelper.getBoolean(
WRAP_RESULT_SETS,
configurationSettings,
false
);
this.getGeneratedKeysEnabled = ConfigurationHelper.getBoolean(
USE_GET_GENERATED_KEYS,
configurationSettings,
@ -606,22 +594,11 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
false
);
this.nativeExceptionHandling51Compliance = ConfigurationHelper.getBoolean(
NATIVE_EXCEPTION_HANDLING_51_COMPLIANCE,
configurationSettings,
false
);
this.queryStatisticsMaxSize = ConfigurationHelper.getInt(
QUERY_STATISTICS_MAX_SIZE,
configurationSettings,
Statistics.DEFAULT_QUERY_STATISTICS_MAX_SIZE
);
if ( context.isJpaBootstrap() && nativeExceptionHandling51Compliance ) {
log.nativeExceptionHandling51ComplianceJpaBootstrapping();
this.nativeExceptionHandling51Compliance = false;
}
}
private SqmMultiTableMutationStrategy resolveSqmMutationStrategy(
@ -1065,11 +1042,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
return jtaTrackByThread;
}
@Override
public Map getQuerySubstitutions() {
return querySubstitutions;
}
@Override
public boolean isNamedQueryStartupCheckingEnabled() {
return namedQueryStartupCheckingEnabled;
@ -1140,11 +1112,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
return scrollableResultSetsEnabled;
}
@Override
public boolean isWrapResultSetsEnabled() {
return wrapResultSetsEnabled;
}
@Override
public boolean isGetGeneratedKeysEnabled() {
return getGeneratedKeysEnabled;
@ -1250,11 +1217,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
return jpaCompliance;
}
@Override
public boolean nativeExceptionHandling51Compliance() {
return nativeExceptionHandling51Compliance;
}
@Override
public int getQueryStatisticsMaxSize() {
return queryStatisticsMaxSize;
@ -1432,11 +1394,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
this.currentTenantIdentifierResolver = resolver;
}
@SuppressWarnings("unchecked")
public void applyQuerySubstitutions(Map substitutions) {
this.querySubstitutions.putAll( substitutions );
}
public void enableNamedQueryCheckingOnStartup(boolean enabled) {
this.namedQueryStartupCheckingEnabled = enabled;
}
@ -1485,11 +1442,6 @@ public class SessionFactoryOptionsBuilder implements SessionFactoryOptions {
this.scrollableResultSetsEnabled = enabled;
}
@Deprecated
public void enableResultSetWrappingSupport(boolean enabled) {
this.wrapResultSetsEnabled = enabled;
}
public void enableGeneratedKeysSupport(boolean enabled) {
this.getGeneratedKeysEnabled = enabled;
}

View File

@ -238,13 +238,6 @@ public abstract class AbstractDelegatingSessionFactoryBuilder<T extends SessionF
return getThis();
}
@Override
@SuppressWarnings("deprecation")
public T applyQuerySubstitutions(Map substitutions) {
delegate.applyQuerySubstitutions( substitutions );
return getThis();
}
@Override
public T applyStrictJpaQueryLanguageCompliance(boolean enabled) {
delegate.applyStrictJpaQueryLanguageCompliance( enabled );
@ -323,12 +316,6 @@ public abstract class AbstractDelegatingSessionFactoryBuilder<T extends SessionF
return getThis();
}
@Override
public T applyResultSetsWrapping(boolean enabled) {
delegate.applyResultSetsWrapping( enabled );
return getThis();
}
@Override
public T applyGetGeneratedKeysSupport(boolean enabled) {
delegate.applyGetGeneratedKeysSupport( enabled );

View File

@ -224,11 +224,6 @@ public class AbstractDelegatingSessionFactoryOptions implements SessionFactoryOp
return delegate.isJtaTrackByThread();
}
@Override
public Map getQuerySubstitutions() {
return delegate.getQuerySubstitutions();
}
@Override
public boolean isNamedQueryStartupCheckingEnabled() {
return delegate.isNamedQueryStartupCheckingEnabled();
@ -309,11 +304,6 @@ public class AbstractDelegatingSessionFactoryOptions implements SessionFactoryOp
return delegate.isScrollableResultSetsEnabled();
}
@Override
public boolean isWrapResultSetsEnabled() {
return delegate.isWrapResultSetsEnabled();
}
@Override
public boolean isGetGeneratedKeysEnabled() {
return delegate.isGetGeneratedKeysEnabled();
@ -440,11 +430,6 @@ public class AbstractDelegatingSessionFactoryOptions implements SessionFactoryOp
return delegate.inClauseParameterPaddingEnabled();
}
@Override
public boolean nativeExceptionHandling51Compliance() {
return delegate.nativeExceptionHandling51Compliance();
}
@Override
public int getQueryStatisticsMaxSize() {
return delegate.getQueryStatisticsMaxSize();

View File

@ -6,7 +6,6 @@
*/
package org.hibernate.boot.spi;
import java.util.Map;
import java.util.TimeZone;
import java.util.function.Supplier;
@ -179,8 +178,6 @@ public interface SessionFactoryOptions extends QueryEngineOptions {
boolean isJtaTrackByThread();
Map getQuerySubstitutions();
/**
* @deprecated Use {@link JpaCompliance#isJpaQueryComplianceEnabled()} instead
* via {@link #getJpaCompliance()}
@ -218,12 +215,6 @@ public interface SessionFactoryOptions extends QueryEngineOptions {
boolean isScrollableResultSetsEnabled();
/**
* @deprecated (since 5.5) Scheduled for removal in 6.0 as ResultSet wrapping is no longer needed
*/
@Deprecated
boolean isWrapResultSetsEnabled();
boolean isGetGeneratedKeysEnabled();
Integer getJdbcFetchSize();
@ -303,10 +294,6 @@ public interface SessionFactoryOptions extends QueryEngineOptions {
return false;
}
default boolean nativeExceptionHandling51Compliance() {
return false;
}
default int getQueryStatisticsMaxSize() {
return Statistics.DEFAULT_QUERY_STATISTICS_MAX_SIZE;
}

View File

@ -602,11 +602,6 @@ public interface AvailableSettings {
*/
String USE_NATIONALIZED_CHARACTER_DATA = "hibernate.use_nationalized_character_data";
/**
* The deprecated name. Use {@link #SCANNER} or {@link #SCANNER_ARCHIVE_INTERPRETER} instead.
*/
String SCANNER_DEPRECATED = "hibernate.ejb.resource_scanner";
/**
* Pass an implementation of {@link org.hibernate.boot.archive.scan.spi.Scanner}.
* Accepts either:<ul>
@ -983,12 +978,6 @@ public interface AvailableSettings {
*/
String QUERY_MULTI_TABLE_INSERT_STRATEGY = "hibernate.query.insert_strategy";
/**
* A comma-separated list of token substitutions to use when translating a Hibernate
* query to SQL
*/
String QUERY_SUBSTITUTIONS = "hibernate.query.substitutions";
/**
* Should named queries be checked during startup (the default is enabled).
* <p/>
@ -1008,34 +997,6 @@ public interface AvailableSettings {
*/
String CONVENTIONAL_JAVA_CONSTANTS = "hibernate.query.conventional_java_constants";
/**
* The {@link org.hibernate.exception.spi.SQLExceptionConverter} to use for converting SQLExceptions
* to Hibernate's JDBCException hierarchy. The default is to use the configured
* {@link org.hibernate.dialect.Dialect}'s preferred SQLExceptionConverter.
*/
String SQL_EXCEPTION_CONVERTER = "hibernate.jdbc.sql_exception_converter";
/**
* Enable wrapping of JDBC result sets in order to speed up column name lookups for
* broken JDBC drivers
*
* @deprecated (since 5.5) Scheduled for removal in 6.0 as ResultSet wrapping is no longer needed
*/
@Deprecated
String WRAP_RESULT_SETS = "hibernate.jdbc.wrap_result_sets";
/**
* Indicates if exception handling for a SessionFactory built via Hibernate's native bootstrapping
* should behave the same as native exception handling in Hibernate ORM 5.1, When set to {@code true},
* {@link HibernateException} will not be wrapped or converted according to the JPA specification.
* <p/>
* This setting will be ignored for a SessionFactory built via JPA bootstrapping.
* <p/>
* Values are {@code true} or {@code false}.
* Default value is {@code false}
*/
String NATIVE_EXCEPTION_HANDLING_51_COMPLIANCE = "hibernate.native_exception_handling_51_compliance";
/**
* Enable ordering of update statements by primary key value
*/
@ -2024,23 +1985,6 @@ public interface AvailableSettings {
*/
String MERGE_ENTITY_COPY_OBSERVER = "hibernate.event.merge.entity_copy_observer";
/**
* Setting which indicates whether or not to use {@link org.hibernate.dialect.pagination.LimitHandler}
* implementations that sacrifices performance optimizations to allow legacy 4.x limit behavior.
* </p>
* Legacy 4.x behavior favored performing pagination in-memory by avoiding the use of the offset
* value, which is overall poor performance. In 5.x, the limit handler behavior favors performance
* thus if the dialect doesn't support offsets, an exception is thrown instead.
* </p>
* Default is {@code false}.
*
* @since 5.2.5
* @deprecated this setting now has no effect
*/
@Deprecated
String USE_LEGACY_LIMIT_HANDLERS = "hibernate.legacy_limit_handler";
/**
* Setting which indicates if {@link Query#setParameter} should not perform parameters validation
*
@ -2588,14 +2532,14 @@ public interface AvailableSettings {
/**
* Caching configuration should follow the following pattern
* {@code hibernate.ejb.classcache.<fully.qualified.Classname> usage[, region]}
* {@code hibernate.classcache.<fully.qualified.Classname> usage[, region]}
* where usage is the cache strategy used and region the cache region name
*/
String CLASS_CACHE_PREFIX = "hibernate.classcache";
/**
* Caching configuration should follow the following pattern
* {@code hibernate.ejb.collectioncache.<fully.qualified.Classname>.<role> usage[, region]}
* {@code hibernate.collectioncache.<fully.qualified.Classname>.<role> usage[, region]}
* where usage is the cache strategy used and region the cache region name
*/
String COLLECTION_CACHE_PREFIX = "hibernate.collectioncache";

View File

@ -16,9 +16,8 @@ import java.util.Set;
import org.hibernate.internal.util.config.ConfigurationHelper;
/**
* Defines support for various externally configurable SessionFactory(s), for
* example, {@link org.hibernate.jmx.HibernateService JMX} or the JCA
* adapter.
* Defines support for various externally configurable SessionFactory(s),
* for example, the JCA adapter.
*
* @author Steve Ebersole
*/
@ -35,7 +34,6 @@ public abstract class ExternalSessionFactoryConfig {
private String getGeneratedKeysEnabled;
private String streamsForBinaryEnabled;
private String reflectionOptimizationEnabled;
private String querySubstitutions;
private String showSqlEnabled;
private String commentsEnabled;
private String cacheRegionFactory;
@ -160,14 +158,6 @@ public abstract class ExternalSessionFactoryConfig {
this.reflectionOptimizationEnabled = reflectionOptimizationEnabled;
}
public final String getQuerySubstitutions() {
return querySubstitutions;
}
public final void setQuerySubstitutions(String querySubstitutions) {
this.querySubstitutions = querySubstitutions;
}
public final String getShowSqlEnabled() {
return showSqlEnabled;
}
@ -267,7 +257,6 @@ public abstract class ExternalSessionFactoryConfig {
setUnlessNull( props, Environment.USE_GET_GENERATED_KEYS, getGeneratedKeysEnabled );
setUnlessNull( props, Environment.USE_STREAMS_FOR_BINARY, streamsForBinaryEnabled );
setUnlessNull( props, Environment.USE_REFLECTION_OPTIMIZER, reflectionOptimizationEnabled );
setUnlessNull( props, Environment.QUERY_SUBSTITUTIONS, querySubstitutions );
setUnlessNull( props, Environment.SHOW_SQL, showSqlEnabled );
setUnlessNull( props, Environment.USE_SQL_COMMENTS, commentsEnabled );
setUnlessNull( props, Environment.CACHE_REGION_FACTORY, cacheRegionFactory );

View File

@ -6,8 +6,6 @@
*/
package org.hibernate.cfg;
import java.util.Map;
import org.hibernate.ConnectionReleaseMode;
import org.hibernate.boot.Metadata;
import org.hibernate.boot.SchemaAutoTooling;
@ -82,7 +80,6 @@ public final class Settings {
LOG.debugf( "JTA Track by Thread: %s", enabledDisabled( sessionFactoryOptions.isJtaTrackByThread() ) );
LOG.debugf( "Query language substitutions: %s", sessionFactoryOptions.getQuerySubstitutions() );
LOG.debugf( "Named query checking : %s", enabledDisabled( sessionFactoryOptions.isNamedQueryStartupCheckingEnabled() ) );
LOG.debugf( "Second-level cache: %s", enabledDisabled( sessionFactoryOptions.isSecondLevelCacheEnabled() ) );
@ -97,7 +94,6 @@ public final class Settings {
LOG.debugf( "JDBC batch size: %s", sessionFactoryOptions.getJdbcBatchSize() );
LOG.debugf( "JDBC batch updates for versioned data: %s", enabledDisabled( sessionFactoryOptions.isJdbcBatchVersionedData() ) );
LOG.debugf( "Scrollable result sets: %s", enabledDisabled( sessionFactoryOptions.isScrollableResultSetsEnabled() ) );
LOG.debugf( "Wrap result sets: %s", enabledDisabled( sessionFactoryOptions.isWrapResultSetsEnabled() ) );
LOG.debugf( "JDBC3 getGeneratedKeys(): %s", enabledDisabled( sessionFactoryOptions.isGetGeneratedKeysEnabled() ) );
LOG.debugf( "JDBC result set fetch size: %s", sessionFactoryOptions.getJdbcFetchSize() );
LOG.debugf( "Connection release mode: %s", sessionFactoryOptions.getConnectionReleaseMode() );
@ -201,10 +197,6 @@ public final class Settings {
return sessionFactoryOptions.isStrictJpaQueryLanguageCompliance();
}
public Map getQuerySubstitutions() {
return sessionFactoryOptions.getQuerySubstitutions();
}
public boolean isNamedQueryStartupCheckingEnabled() {
return sessionFactoryOptions.isNamedQueryStartupCheckingEnabled();
}
@ -275,10 +267,6 @@ public final class Settings {
return sessionFactoryOptions.isScrollableResultSetsEnabled();
}
public boolean isWrapResultSetsEnabled() {
return sessionFactoryOptions.isWrapResultSetsEnabled();
}
public boolean isGetGeneratedKeysEnabled() {
return sessionFactoryOptions.isGetGeneratedKeysEnabled();
}

View File

@ -1747,10 +1747,6 @@ public interface CoreMessageLogger extends BasicLogger {
+ "in the same package as class %1$s. In this case, the class should be opened and exported to Hibernate ORM.", id = 488)
String bytecodeEnhancementFailedUnableToGetPrivateLookupFor(String className);
@LogMessage(level = WARN)
@Message(value = "Setting " + AvailableSettings.NATIVE_EXCEPTION_HANDLING_51_COMPLIANCE + "=true is not valid with JPA bootstrapping; setting will be ignored.", id = 489 )
void nativeExceptionHandling51ComplianceJpaBootstrapping();
@LogMessage(level = INFO)
@Message(value = "Using JtaPlatform implementation: [%s]", id = 490)
void usingJtaPlatform(String jtaPlatformClassName);

View File

@ -47,12 +47,10 @@ public class ExceptionConverterImpl implements ExceptionConverter {
private final SharedSessionContractImplementor sharedSessionContract;
private final boolean isJpaBootstrap;
private final boolean nativeExceptionHandling51Compliance;
public ExceptionConverterImpl(SharedSessionContractImplementor sharedSessionContract) {
this.sharedSessionContract = sharedSessionContract;
isJpaBootstrap = sharedSessionContract.getFactory().getSessionFactoryOptions().isJpaBootstrap();
nativeExceptionHandling51Compliance = sharedSessionContract.getFactory().getSessionFactoryOptions().nativeExceptionHandling51Compliance();
}
@Override
@ -90,104 +88,84 @@ public class ExceptionConverterImpl implements ExceptionConverter {
@Override
public RuntimeException convert(HibernateException e, LockOptions lockOptions) {
if ( !nativeExceptionHandling51Compliance ) {
Throwable cause = e;
if ( cause instanceof StaleStateException ) {
final PersistenceException converted = wrapStaleStateException( (StaleStateException) cause );
handlePersistenceException( converted );
return converted;
Throwable cause = e;
if ( cause instanceof StaleStateException ) {
final PersistenceException converted = wrapStaleStateException( (StaleStateException) cause );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof LockAcquisitionException ) {
final PersistenceException converted = wrapLockException( (HibernateException) cause, lockOptions );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof LockingStrategyException ) {
final PersistenceException converted = wrapLockException( (HibernateException) cause, lockOptions );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof org.hibernate.PessimisticLockException ) {
final PersistenceException converted = wrapLockException( (HibernateException) cause, lockOptions );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof org.hibernate.QueryTimeoutException ) {
final QueryTimeoutException converted = new QueryTimeoutException( cause.getMessage(), cause );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof ObjectNotFoundException ) {
final EntityNotFoundException converted = new EntityNotFoundException( cause.getMessage() );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof org.hibernate.NonUniqueObjectException ) {
final EntityExistsException converted = new EntityExistsException( cause.getMessage() );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof org.hibernate.NonUniqueResultException ) {
final NonUniqueResultException converted = new NonUniqueResultException( cause.getMessage() );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof UnresolvableObjectException ) {
final EntityNotFoundException converted = new EntityNotFoundException( cause.getMessage() );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof SemanticException ) {
return new IllegalArgumentException( cause );
}
else if ( cause instanceof QueryException ) {
return new IllegalArgumentException( cause );
}
else if ( cause instanceof InterpretationException ) {
return new IllegalArgumentException( cause );
}
else if ( cause instanceof ParsingException ) {
return new IllegalArgumentException( cause );
}
else if ( cause instanceof MultipleBagFetchException ) {
return new IllegalArgumentException( cause );
}
else if ( cause instanceof TransientObjectException ) {
try {
sharedSessionContract.markForRollbackOnly();
}
else if ( cause instanceof LockAcquisitionException ) {
final PersistenceException converted = wrapLockException( (HibernateException) cause, lockOptions );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof LockingStrategyException ) {
final PersistenceException converted = wrapLockException( (HibernateException) cause, lockOptions );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof org.hibernate.PessimisticLockException ) {
final PersistenceException converted = wrapLockException( (HibernateException) cause, lockOptions );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof org.hibernate.QueryTimeoutException ) {
final QueryTimeoutException converted = new QueryTimeoutException( cause.getMessage(), cause );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof ObjectNotFoundException ) {
final EntityNotFoundException converted = new EntityNotFoundException( cause.getMessage() );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof org.hibernate.NonUniqueObjectException ) {
final EntityExistsException converted = new EntityExistsException( cause.getMessage() );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof org.hibernate.NonUniqueResultException ) {
final NonUniqueResultException converted = new NonUniqueResultException( cause.getMessage() );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof UnresolvableObjectException ) {
final EntityNotFoundException converted = new EntityNotFoundException( cause.getMessage() );
handlePersistenceException( converted );
return converted;
}
else if ( cause instanceof SemanticException ) {
return new IllegalArgumentException( cause );
}
else if ( cause instanceof QueryException ) {
return new IllegalArgumentException( cause );
}
else if ( cause instanceof InterpretationException ) {
return new IllegalArgumentException( cause );
}
else if ( cause instanceof ParsingException ) {
return new IllegalArgumentException( cause );
}
else if ( cause instanceof MultipleBagFetchException ) {
return new IllegalArgumentException( cause );
}
else if ( cause instanceof TransientObjectException ) {
try {
sharedSessionContract.markForRollbackOnly();
}
catch (Exception ne) {
//we do not want the subsequent exception to swallow the original one
log.unableToMarkForRollbackOnTransientObjectException( ne );
}
return new IllegalStateException( e ); //Spec 3.2.3 Synchronization rules
}
else {
final PersistenceException converted = new PersistenceException(
"Converting `" + cause.getClass().getName() + "` to JPA `PersistenceException` : " + cause.getMessage(),
cause
);
handlePersistenceException( converted );
return converted;
catch (Exception ne) {
//we do not want the subsequent exception to swallow the original one
log.unableToMarkForRollbackOnTransientObjectException( ne );
}
return new IllegalStateException( e ); //Spec 3.2.3 Synchronization rules
}
else {
if ( e instanceof QueryException ) {
return e;
}
else if ( e instanceof MultipleBagFetchException ) {
return e;
}
else {
try {
sharedSessionContract.markForRollbackOnly();
}
catch (Exception ne) {
//we do not want the subsequent exception to swallow the original one
log.unableToMarkForRollbackOnTransientObjectException( ne );
}
return e;
}
final PersistenceException converted = new PersistenceException(
"Converting `" + cause.getClass().getName() + "` to JPA `PersistenceException` : " + cause.getMessage(),
cause
);
handlePersistenceException( converted );
return converted;
}
}

View File

@ -31,28 +31,6 @@ public interface DeprecationLogger extends BasicLogger {
CATEGORY
);
/**
* Log about usage of deprecated Scanner setting
*/
@LogMessage( level = INFO )
@Message(
value = "Found usage of deprecated setting for specifying Scanner [hibernate.ejb.resource_scanner]; " +
"use [hibernate.archive.scanner] instead",
id = 90000001
)
public void logDeprecatedScannerSetting();
// /**
// * Log message indicating the use of features that were only useful for DOM4J EntityMode,
// * which was removed a long time ago.
// */
// @LogMessage( level = WARN )
// @Message(
// value = "Use of DOM4J entity-mode is considered deprecated",
// id = 90000003
// )
// public void logDeprecationOfDomEntityModeSupport();
@LogMessage(level = WARN)
@Message(
value = "embed-xml attributes were intended to be used for DOM4J entity mode. Since that entity mode has been " +

View File

@ -9,8 +9,6 @@ package org.hibernate.orm.test.exceptionhandling;
import java.util.Arrays;
import java.util.Map;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.testing.junit4.CustomParameterized;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@ -18,52 +16,23 @@ import org.junit.runners.Parameterized;
@RunWith(CustomParameterized.class)
public abstract class BaseExceptionHandlingTest extends BaseJpaOrNativeBootstrapFunctionalTestCase {
private static final String EXCEPTION_HANDLING_PROPERTY =
AvailableSettings.NATIVE_EXCEPTION_HANDLING_51_COMPLIANCE;
public enum ExceptionHandlingSetting {
DEFAULT,
TRUE,
FALSE
}
@Parameterized.Parameters(name = "Bootstrap={0}, ExceptionHandlingSetting={1}")
public static Iterable<Object[]> parameters() {
return Arrays.asList( new Object[][] {
{ BootstrapMethod.JPA, ExceptionHandlingSetting.DEFAULT, ExceptionExpectations.jpa() },
{ BootstrapMethod.JPA, ExceptionHandlingSetting.TRUE, ExceptionExpectations.jpa() },
{ BootstrapMethod.JPA, ExceptionHandlingSetting.FALSE, ExceptionExpectations.jpa() },
{ BootstrapMethod.NATIVE, ExceptionHandlingSetting.DEFAULT, ExceptionExpectations.nativePost52() },
{ BootstrapMethod.NATIVE, ExceptionHandlingSetting.TRUE, ExceptionExpectations.nativePre52() },
{ BootstrapMethod.NATIVE, ExceptionHandlingSetting.FALSE, ExceptionExpectations.nativePost52() }
{ BootstrapMethod.JPA, ExceptionExpectations.jpa() },
{ BootstrapMethod.NATIVE, ExceptionExpectations.nativePost52() },
} );
}
private final ExceptionHandlingSetting exceptionHandlingSetting;
protected final ExceptionExpectations exceptionExpectations;
protected BaseExceptionHandlingTest(
BootstrapMethod bootstrapMethod,
ExceptionHandlingSetting exceptionHandlingSetting,
ExceptionExpectations exceptionExpectations) {
super( bootstrapMethod );
this.exceptionHandlingSetting = exceptionHandlingSetting;
this.exceptionExpectations = exceptionExpectations;
}
@Override
protected void configure(Map<Object, Object> properties) {
switch ( exceptionHandlingSetting ) {
case DEFAULT:
// Keep the default
break;
case TRUE:
properties.put( EXCEPTION_HANDLING_PROPERTY, "true" );
break;
case FALSE:
properties.put( EXCEPTION_HANDLING_PROPERTY, "false" );
break;
}
}
protected void configure(Map<Object, Object> properties) {}
}

View File

@ -27,9 +27,8 @@ import org.junit.Test;
public class ConstraintViolationExceptionHandlingTest extends BaseExceptionHandlingTest {
public ConstraintViolationExceptionHandlingTest(BootstrapMethod bootstrapMethod,
ExceptionHandlingSetting exceptionHandlingSetting,
ExceptionExpectations exceptionExpectations) {
super( bootstrapMethod, exceptionHandlingSetting, exceptionExpectations );
super( bootstrapMethod, exceptionExpectations );
}
@Override

View File

@ -29,9 +29,8 @@ public class IdentifierGenerationExceptionHandlingTest extends BaseExceptionHand
public IdentifierGenerationExceptionHandlingTest(
BootstrapMethod bootstrapMethod,
ExceptionHandlingSetting exceptionHandlingSetting,
ExceptionExpectations exceptionExpectations) {
super( bootstrapMethod, exceptionHandlingSetting, exceptionExpectations );
super( bootstrapMethod, exceptionExpectations );
}
@Override

View File

@ -24,9 +24,8 @@ public class QueryExceptionHandlingTest extends BaseExceptionHandlingTest {
public QueryExceptionHandlingTest(
BootstrapMethod bootstrapMethod,
ExceptionHandlingSetting exceptionHandlingSetting,
ExceptionExpectations exceptionExpectations) {
super( bootstrapMethod, exceptionHandlingSetting, exceptionExpectations );
super( bootstrapMethod, exceptionExpectations );
}
@Override

View File

@ -25,9 +25,8 @@ public class StaleObjectStateExceptionHandlingTest extends BaseExceptionHandling
public StaleObjectStateExceptionHandlingTest(
BootstrapMethod bootstrapMethod,
ExceptionHandlingSetting exceptionHandlingSetting,
ExceptionExpectations exceptionExpectations) {
super( bootstrapMethod, exceptionHandlingSetting, exceptionExpectations );
super( bootstrapMethod, exceptionExpectations );
}
@Override

View File

@ -27,9 +27,8 @@ public class TransactionExceptionHandlingTest extends BaseExceptionHandlingTest
public TransactionExceptionHandlingTest(
BootstrapMethod bootstrapMethod,
ExceptionHandlingSetting exceptionHandlingSetting,
ExceptionExpectations exceptionExpectations) {
super( bootstrapMethod, exceptionHandlingSetting, exceptionExpectations );
super( bootstrapMethod, exceptionExpectations );
}
@Override

View File

@ -25,9 +25,8 @@ import static org.junit.Assert.fail;
public class TransientObjectExceptionHandlingTest extends BaseExceptionHandlingTest {
public TransientObjectExceptionHandlingTest(BootstrapMethod bootstrapMethod,
ExceptionHandlingSetting exceptionHandlingSetting,
ExceptionExpectations exceptionExpectations) {
super( bootstrapMethod, exceptionHandlingSetting, exceptionExpectations );
super( bootstrapMethod, exceptionExpectations );
}
@Override