Skip to content

Commit 5140ea7

Browse files
jrenaatsebersole
authored andcommitted
HHH-19660 - Deprecate enhancement support for automatic association management
Signed-off-by: Jan Schatteman <[email protected]>
1 parent 65b9920 commit 5140ea7

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

documentation/src/main/asciidoc/userguide/chapters/pc/BytecodeEnhancement.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ include::{example-dir-enhancement}/BytecodeEnhancementTest.java[tags=BytecodeEnh
9999

100100
Bytecode-enhanced bi-directional association management makes that first example work by managing the "other side" of a bi-directional association whenever one side is manipulated.
101101

102+
[IMPORTANT]
103+
Hibernate's bidirectional association management bytecode enhancement feature has been deprecated. Users should instead manage both sides of such associations directly.
104+
102105
[[BytecodeEnhancement-dirty-tracking-optimizations]]
103106
==== Internal performance optimizations
104107

hibernate-core/src/main/java/org/hibernate/bytecode/enhance/spi/EnhancementContext.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ public interface EnhancementContext {
6868
* @return {@code true} indicates that the field is enhanced so that for bi-directional persistent fields
6969
* the association is managed, i.e. the associations are automatically set; {@code false} indicates that
7070
* the management is handled by the user.
71+
* @deprecated Will be removed without replacement. See HHH-19660
7172
*/
73+
@Deprecated(forRemoval = true)
7274
boolean doBiDirectionalAssociationManagement(UnloadedField field);
7375

7476
/**

tooling/hibernate-ant/src/main/java/org/hibernate/tool/enhance/EnhancementTask.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ public boolean doExtendedEnhancement(UnloadedClass classDescriptor) {
204204
DEPRECATION_LOGGER.deprecatedSettingForRemoval("extended enhancement", "false");
205205
}
206206

207+
if ( enableAssociationManagement ) {
208+
DEPRECATION_LOGGER.deprecatedSettingForRemoval( "management of bi-directional association persistent attributes", "false" );
209+
}
210+
207211
final BytecodeProvider bytecodeProvider = buildDefaultBytecodeProvider();
208212
try {
209213
Enhancer enhancer = bytecodeProvider.getEnhancer( enhancementContext );

tooling/hibernate-gradle-plugin/src/main/java/org/hibernate/orm/tooling/gradle/enhance/EnhancementHelper.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public static void enhance(
4747
if ( !enhancementDsl.getEnableLazyInitialization().get() ) {
4848
logger.warn( "The 'enableLazyInitialization' configuration is deprecated and will be removed. Set the value to 'true' to get rid of this warning" );
4949
}
50+
if ( enhancementDsl.getEnableAssociationManagement().get() ) {
51+
logger.warn("Management of bi-directional association persistent attributes is deprecated and will be removed. Set the value to 'false' to get rid of this warning" );
52+
}
5053
if ( !enhancementDsl.getEnableDirtyTracking().get() ) {
5154
logger.warn( "The 'enableDirtyTracking' configuration is deprecated and will be removed. Set the value to 'true' to get rid of this warning" );
5255
}

tooling/hibernate-maven-plugin/src/main/java/org/hibernate/orm/tooling/maven/EnhancementContext.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public ClassLoader getLoadingClassLoader() {
3838

3939
@Override
4040
public boolean doBiDirectionalAssociationManagement(UnloadedField field) {
41+
if ( enableAssociationManagement ) {
42+
DEPRECATION_LOGGER.deprecatedSettingForRemoval( "management of bi-directional persistent association attributes", "false" );
43+
}
4144
return enableAssociationManagement;
4245
}
4346

0 commit comments

Comments
 (0)