HHH-15631 Enable reflection optimizer by default Christian Beikov

This commit is contained in:
Christian Beikov 2022-11-09 01:10:43 +01:00
parent 4fdbb3d5f6
commit 7a14e5c07f
6 changed files with 19 additions and 8 deletions

View File

@ -462,8 +462,8 @@ Enable association management feature in runtime bytecode enhancement which auto
`*hibernate.bytecode.provider*` (e.g. `bytebuddy` (default value))::
The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/BytecodeProvider.html[`BytecodeProvider`] built-in implementation flavor. Currently, only `bytebuddy` is a valid value, as older deprecated options have been removed.
`*hibernate.bytecode.use_reflection_optimizer*` (e.g. `true` or `false` (default value))::
Should we use reflection optimization? The reflection optimizer implements the https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/ReflectionOptimizer.html[`ReflectionOptimizer`] interface and improves entity instantiation and property getter/setter calls.
`*hibernate.bytecode.use_reflection_optimizer*` (e.g. `true` (default value) or `false`)::
Should we use reflection optimization? The reflection optimizer implements the https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/ReflectionOptimizer.html[`ReflectionOptimizer`] interface and improves entity instantiation and property getter/setter calls. This setting is deprecated for removal without a replacement.
[[configurations-query]]
=== Query settings

View File

@ -355,9 +355,9 @@ hibernate.max_fetch_depth 1
#hibernate.use_identifier_rollback true
## enable bytecode reflection optimizer (disabled by default)
## disable bytecode reflection optimizer (enabled by default)
#hibernate.bytecode.use_reflection_optimizer true
#hibernate.bytecode.use_reflection_optimizer false

View File

@ -322,9 +322,9 @@ hibernate.default_batch_fetch_size 8
#hibernate.use_identifier_rollback true
## enable bytecode reflection optimizer (disabled by default)
## disable bytecode reflection optimizer (enabled by default)
#hibernate.bytecode.use_reflection_optimizer true
#hibernate.bytecode.use_reflection_optimizer false

View File

@ -1034,7 +1034,10 @@ public interface AvailableSettings {
/**
* When enabled, specifies that property access should be optimized via the use
* of generated bytecode.
*
* @deprecated Will be removed without replacement. See HHH-15631
*/
@Deprecated(forRemoval = true)
String USE_REFLECTION_OPTIMIZER = "hibernate.bytecode.use_reflection_optimizer";
/**

View File

@ -14,11 +14,14 @@ import org.hibernate.HibernateException;
import org.hibernate.Version;
import org.hibernate.bytecode.spi.BytecodeProvider;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.internal.log.DeprecationLogger;
import org.hibernate.internal.util.ConfigHelper;
import org.hibernate.internal.util.config.ConfigurationHelper;
import org.jboss.logging.Logger;
import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
/**
* Provides access to configuration properties passed in {@link Properties} objects.
@ -138,8 +141,7 @@ public final class Environment implements AvailableSettings {
Version.logVersion();
GLOBAL_PROPERTIES = new Properties();
//Set USE_REFLECTION_OPTIMIZER to false to fix HHH-227
GLOBAL_PROPERTIES.setProperty( USE_REFLECTION_OPTIMIZER, Boolean.FALSE.toString() );
GLOBAL_PROPERTIES.setProperty( USE_REFLECTION_OPTIMIZER, Boolean.TRUE.toString() );
try {
InputStream stream = ConfigHelper.getResourceAsStream( "/hibernate.properties" );
@ -179,6 +181,9 @@ public final class Environment implements AvailableSettings {
if ( ENABLE_REFLECTION_OPTIMIZER ) {
LOG.usingReflectionOptimizer();
}
else {
DEPRECATION_LOGGER.deprecatedSettingForRemoval( USE_REFLECTION_OPTIMIZER, "true" );
}
BYTECODE_PROVIDER_INSTANCE = buildBytecodeProvider( GLOBAL_PROPERTIES );
}

View File

@ -94,3 +94,6 @@ The `enableLazyInitialization` and `enableDirtyTracking` enhancement tooling opt
as well as the respective `hibernate.enhancer.enableLazyInitialization` and `hibernate.enhancer.enableDirtyTracking` configuration settings,
switched their default values to `true` and the settings are now deprecated for removal without replacement.
See link:https://hibernate.atlassian.net/browse/HHH-15641[HHH-15641] for details.
The global property `hibernate.bytecode.use_reflection_optimizer` switched the default value to `true`
and the setting is now deprecated for removal without replacement. See link:https://hibernate.atlassian.net/browse/HHH-15631[HHH-15631] for details.