HHH-18442 Drop DynamicInsert#value and DynamicUpdate#value

This commit is contained in:
Andrea Boriero 2024-07-30 10:21:12 +02:00 committed by Steve Ebersole
parent 8eb7d5457e
commit 409640cd01
7 changed files with 5 additions and 53 deletions

View File

@ -26,9 +26,4 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Target( TYPE ) @Target( TYPE )
@Retention( RUNTIME ) @Retention( RUNTIME )
public @interface DynamicInsert { public @interface DynamicInsert {
/**
* @deprecated When {@code false}, this annotation has no effect.
*/
@Deprecated(since = "6.0")
boolean value() default true;
} }

View File

@ -27,9 +27,4 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Target( TYPE ) @Target( TYPE )
@Retention( RUNTIME ) @Retention( RUNTIME )
public @interface DynamicUpdate { public @interface DynamicUpdate {
/**
* @deprecated When {@code false}, this annotation has no effect.
*/
@Deprecated(since = "6.0")
boolean value() default true;
} }

View File

@ -1263,10 +1263,10 @@ public class EntityBinder {
private void bindRowManagement() { private void bindRowManagement() {
final DynamicInsert dynamicInsertAnn = annotatedClass.getAnnotationUsage( DynamicInsert.class, getSourceModelContext() ); final DynamicInsert dynamicInsertAnn = annotatedClass.getAnnotationUsage( DynamicInsert.class, getSourceModelContext() );
persistentClass.setDynamicInsert( dynamicInsertAnn != null && dynamicInsertAnn.value() ); persistentClass.setDynamicInsert( dynamicInsertAnn != null );
final DynamicUpdate dynamicUpdateAnn = annotatedClass.getAnnotationUsage( DynamicUpdate.class, getSourceModelContext() ); final DynamicUpdate dynamicUpdateAnn = annotatedClass.getAnnotationUsage( DynamicUpdate.class, getSourceModelContext() );
persistentClass.setDynamicUpdate( dynamicUpdateAnn != null && dynamicUpdateAnn.value() ); persistentClass.setDynamicUpdate( dynamicUpdateAnn != null );
if ( persistentClass.useDynamicInsert() && annotatedClass.hasAnnotationUsage( SQLInsert.class, getSourceModelContext() ) ) { if ( persistentClass.useDynamicInsert() && annotatedClass.hasAnnotationUsage( SQLInsert.class, getSourceModelContext() ) ) {
throw new AnnotationException( "Entity '" + name + "' is annotated both '@DynamicInsert' and '@SQLInsert'" ); throw new AnnotationException( "Entity '" + name + "' is annotated both '@DynamicInsert' and '@SQLInsert'" );

View File

@ -20,42 +20,27 @@ import static org.hibernate.boot.models.internal.OrmAnnotationHelper.extractJdkV
@SuppressWarnings({ "ClassExplicitlyAnnotation", "unused" }) @SuppressWarnings({ "ClassExplicitlyAnnotation", "unused" })
@jakarta.annotation.Generated("org.hibernate.orm.build.annotations.ClassGeneratorProcessor") @jakarta.annotation.Generated("org.hibernate.orm.build.annotations.ClassGeneratorProcessor")
public class DynamicInsertAnnotation implements DynamicInsert { public class DynamicInsertAnnotation implements DynamicInsert {
private boolean value;
/** /**
* Used in creating dynamic annotation instances (e.g. from XML) * Used in creating dynamic annotation instances (e.g. from XML)
*/ */
public DynamicInsertAnnotation(SourceModelBuildingContext modelContext) { public DynamicInsertAnnotation(SourceModelBuildingContext modelContext) {
this.value = true;
} }
/** /**
* Used in creating annotation instances from JDK variant * Used in creating annotation instances from JDK variant
*/ */
public DynamicInsertAnnotation(DynamicInsert annotation, SourceModelBuildingContext modelContext) { public DynamicInsertAnnotation(DynamicInsert annotation, SourceModelBuildingContext modelContext) {
this.value = annotation.value();
} }
/** /**
* Used in creating annotation instances from Jandex variant * Used in creating annotation instances from Jandex variant
*/ */
public DynamicInsertAnnotation(AnnotationInstance annotation, SourceModelBuildingContext modelContext) { public DynamicInsertAnnotation(AnnotationInstance annotation, SourceModelBuildingContext modelContext) {
this.value = extractJandexValue( annotation, HibernateAnnotations.DYNAMIC_INSERT, "value", modelContext );
} }
@Override @Override
public Class<? extends Annotation> annotationType() { public Class<? extends Annotation> annotationType() {
return DynamicInsert.class; return DynamicInsert.class;
} }
@Override
public boolean value() {
return value;
}
public void value(boolean value) {
this.value = value;
}
} }

View File

@ -25,36 +25,22 @@ public class DynamicUpdateAnnotation implements DynamicUpdate {
* Used in creating dynamic annotation instances (e.g. from XML) * Used in creating dynamic annotation instances (e.g. from XML)
*/ */
public DynamicUpdateAnnotation(SourceModelBuildingContext modelContext) { public DynamicUpdateAnnotation(SourceModelBuildingContext modelContext) {
this.value = true;
} }
/** /**
* Used in creating annotation instances from JDK variant * Used in creating annotation instances from JDK variant
*/ */
public DynamicUpdateAnnotation(DynamicUpdate annotation, SourceModelBuildingContext modelContext) { public DynamicUpdateAnnotation(DynamicUpdate annotation, SourceModelBuildingContext modelContext) {
this.value = annotation.value();
} }
/** /**
* Used in creating annotation instances from Jandex variant * Used in creating annotation instances from Jandex variant
*/ */
public DynamicUpdateAnnotation(AnnotationInstance annotation, SourceModelBuildingContext modelContext) { public DynamicUpdateAnnotation(AnnotationInstance annotation, SourceModelBuildingContext modelContext) {
this.value = extractJandexValue( annotation, HibernateAnnotations.DYNAMIC_UPDATE, "value", modelContext );
} }
@Override @Override
public Class<? extends Annotation> annotationType() { public Class<? extends Annotation> annotationType() {
return DynamicUpdate.class; return DynamicUpdate.class;
} }
@Override
public boolean value() {
return value;
}
public void value(boolean value) {
this.value = value;
}
} }

View File

@ -404,19 +404,10 @@ public class EntityTypeMetadataImpl
} }
private boolean decodeDynamicInsert() { private boolean decodeDynamicInsert() {
final DynamicInsert dynamicInsertAnnotation = getClassDetails().getDirectAnnotationUsage( DynamicInsert.class ); return getClassDetails().getDirectAnnotationUsage( DynamicInsert.class ) != null;
if ( dynamicInsertAnnotation == null ) {
return false;
}
return dynamicInsertAnnotation.value();
} }
private boolean decodeDynamicUpdate() { private boolean decodeDynamicUpdate() {
final DynamicUpdate dynamicUpdateAnnotation = getClassDetails().getDirectAnnotationUsage( DynamicUpdate.class ); return getClassDetails().getDirectAnnotationUsage( DynamicUpdate.class ) != null;
if ( dynamicUpdateAnnotation == null ) {
return false;
}
return dynamicUpdateAnnotation.value();
} }
} }

View File

@ -151,7 +151,7 @@ String isDefault();
* Removed `@SelectBeforeUpdate` * Removed `@SelectBeforeUpdate`
* Removed `org.hibernate.Session#delete(Object object)` and `org.hibernate.Session#delete(String entityName, Object object)` in favor of `org.hibernate.Session#remove(Object object)` * Removed `org.hibernate.Session#delete(Object object)` and `org.hibernate.Session#delete(String entityName, Object object)` in favor of `org.hibernate.Session#remove(Object object)`
* Removed `org.hibernate.annotations.CascadeType.DELETE` in favor of `org.hibernate.annotations.CascadeType#REMOVE` * Removed `org.hibernate.annotations.CascadeType.DELETE` in favor of `org.hibernate.annotations.CascadeType#REMOVE`
* Removed the attribute value from `@DynamicInsert` and `@DynamicUpdate`
[WARNING] [WARNING]
=== ===