HHH-15631 Enable reflection optimizer by default Christian Beikov
This commit is contained in:
parent
4fdbb3d5f6
commit
7a14e5c07f
|
@ -462,8 +462,8 @@ Enable association management feature in runtime bytecode enhancement which auto
|
||||||
`*hibernate.bytecode.provider*` (e.g. `bytebuddy` (default value))::
|
`*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.
|
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))::
|
`*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.
|
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]]
|
[[configurations-query]]
|
||||||
=== Query settings
|
=== Query settings
|
||||||
|
|
|
@ -355,9 +355,9 @@ hibernate.max_fetch_depth 1
|
||||||
#hibernate.use_identifier_rollback true
|
#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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -322,9 +322,9 @@ hibernate.default_batch_fetch_size 8
|
||||||
#hibernate.use_identifier_rollback true
|
#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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1034,7 +1034,10 @@ public interface AvailableSettings {
|
||||||
/**
|
/**
|
||||||
* When enabled, specifies that property access should be optimized via the use
|
* When enabled, specifies that property access should be optimized via the use
|
||||||
* of generated bytecode.
|
* of generated bytecode.
|
||||||
|
*
|
||||||
|
* @deprecated Will be removed without replacement. See HHH-15631
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true)
|
||||||
String USE_REFLECTION_OPTIMIZER = "hibernate.bytecode.use_reflection_optimizer";
|
String USE_REFLECTION_OPTIMIZER = "hibernate.bytecode.use_reflection_optimizer";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -14,11 +14,14 @@ import org.hibernate.HibernateException;
|
||||||
import org.hibernate.Version;
|
import org.hibernate.Version;
|
||||||
import org.hibernate.bytecode.spi.BytecodeProvider;
|
import org.hibernate.bytecode.spi.BytecodeProvider;
|
||||||
import org.hibernate.internal.CoreMessageLogger;
|
import org.hibernate.internal.CoreMessageLogger;
|
||||||
|
import org.hibernate.internal.log.DeprecationLogger;
|
||||||
import org.hibernate.internal.util.ConfigHelper;
|
import org.hibernate.internal.util.ConfigHelper;
|
||||||
import org.hibernate.internal.util.config.ConfigurationHelper;
|
import org.hibernate.internal.util.config.ConfigurationHelper;
|
||||||
|
|
||||||
import org.jboss.logging.Logger;
|
import org.jboss.logging.Logger;
|
||||||
|
|
||||||
|
import static org.hibernate.internal.log.DeprecationLogger.DEPRECATION_LOGGER;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides access to configuration properties passed in {@link Properties} objects.
|
* Provides access to configuration properties passed in {@link Properties} objects.
|
||||||
|
@ -138,8 +141,7 @@ public final class Environment implements AvailableSettings {
|
||||||
Version.logVersion();
|
Version.logVersion();
|
||||||
|
|
||||||
GLOBAL_PROPERTIES = new Properties();
|
GLOBAL_PROPERTIES = new Properties();
|
||||||
//Set USE_REFLECTION_OPTIMIZER to false to fix HHH-227
|
GLOBAL_PROPERTIES.setProperty( USE_REFLECTION_OPTIMIZER, Boolean.TRUE.toString() );
|
||||||
GLOBAL_PROPERTIES.setProperty( USE_REFLECTION_OPTIMIZER, Boolean.FALSE.toString() );
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
InputStream stream = ConfigHelper.getResourceAsStream( "/hibernate.properties" );
|
InputStream stream = ConfigHelper.getResourceAsStream( "/hibernate.properties" );
|
||||||
|
@ -179,6 +181,9 @@ public final class Environment implements AvailableSettings {
|
||||||
if ( ENABLE_REFLECTION_OPTIMIZER ) {
|
if ( ENABLE_REFLECTION_OPTIMIZER ) {
|
||||||
LOG.usingReflectionOptimizer();
|
LOG.usingReflectionOptimizer();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
DEPRECATION_LOGGER.deprecatedSettingForRemoval( USE_REFLECTION_OPTIMIZER, "true" );
|
||||||
|
}
|
||||||
|
|
||||||
BYTECODE_PROVIDER_INSTANCE = buildBytecodeProvider( GLOBAL_PROPERTIES );
|
BYTECODE_PROVIDER_INSTANCE = buildBytecodeProvider( GLOBAL_PROPERTIES );
|
||||||
}
|
}
|
||||||
|
|
|
@ -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,
|
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.
|
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.
|
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.
|
||||||
|
|
Loading…
Reference in New Issue