diff --git a/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc b/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc index e70b11b420..75ff5d99c9 100644 --- a/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc +++ b/documentation/src/main/asciidoc/userguide/appendices/Configurations.adoc @@ -434,7 +434,7 @@ Enable lazy loading feature in runtime bytecode enhancement. This way, even basi Enable association management feature in runtime bytecode enhancement which automatically synchronizes a bidirectional association when only one side is changed. `*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` and `javassist` are valid values. +The https://docs.jboss.org/hibernate/orm/{majorMinorVersion}/javadocs/org/hibernate/bytecode/spi/BytecodeProvider.html[`BytecodeProvider`] built-in implementation flavor. Currently, only `bytebuddy` and `javassist` are valid values; `bytebuddy` is the default and recommended choice; `javassist` will be removed soon. `*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. diff --git a/hibernate-core/src/main/java/org/hibernate/bytecode/internal/javassist/BytecodeProviderImpl.java b/hibernate-core/src/main/java/org/hibernate/bytecode/internal/javassist/BytecodeProviderImpl.java index 995ab83f49..ca588e2519 100644 --- a/hibernate-core/src/main/java/org/hibernate/bytecode/internal/javassist/BytecodeProviderImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/bytecode/internal/javassist/BytecodeProviderImpl.java @@ -21,9 +21,13 @@ import org.jboss.logging.Logger; /** * Bytecode provider implementation for Javassist. + * @deprecated The Javassist based enhancer will be removed soon, + * please use the one based on ByteBuddy (which is the default since + * version 5.3 of Hibernate ORM) * * @author Steve Ebersole */ +@Deprecated public class BytecodeProviderImpl implements BytecodeProvider { private static final CoreMessageLogger LOG = Logger.getMessageLogger( CoreMessageLogger.class, diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java b/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java index 824f556d1f..892a07f350 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/Environment.java @@ -346,6 +346,7 @@ public final class Environment implements AvailableSettings { } if ( BYTECODE_PROVIDER_NAME_JAVASSIST.equals( providerName ) ) { + LOG.warnUsingJavassistBytecodeProviderIsDeprecated(); return new org.hibernate.bytecode.internal.javassist.BytecodeProviderImpl(); } diff --git a/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java b/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java index 096aa3ec3d..04083199e9 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/CoreMessageLogger.java @@ -1860,4 +1860,9 @@ public interface CoreMessageLogger extends BasicLogger { @Message(value = "Detaching an uninitialized collection with enabled filters from a session: %s", id = 506) void enabledFiltersWhenDetachFromSession(String collectionInfoString); + @LogMessage(level = WARN) + @Message(value = "The Javassist based BytecodeProvider is deprecated. Please switch to using the ByteBuddy based BytecodeProvider, " + + "which is the default since Hibernate ORM 5.3. The Javassist one will be removed soon.", id = 507) + void warnUsingJavassistBytecodeProviderIsDeprecated(); + }