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 )
@Retention( RUNTIME )
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 )
@Retention( RUNTIME )
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() {
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() );
persistentClass.setDynamicUpdate( dynamicUpdateAnn != null && dynamicUpdateAnn.value() );
persistentClass.setDynamicUpdate( dynamicUpdateAnn != null );
if ( persistentClass.useDynamicInsert() && annotatedClass.hasAnnotationUsage( SQLInsert.class, getSourceModelContext() ) ) {
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" })
@jakarta.annotation.Generated("org.hibernate.orm.build.annotations.ClassGeneratorProcessor")
public class DynamicInsertAnnotation implements DynamicInsert {
private boolean value;
/**
* Used in creating dynamic annotation instances (e.g. from XML)
*/
public DynamicInsertAnnotation(SourceModelBuildingContext modelContext) {
this.value = true;
}
/**
* Used in creating annotation instances from JDK variant
*/
public DynamicInsertAnnotation(DynamicInsert annotation, SourceModelBuildingContext modelContext) {
this.value = annotation.value();
}
/**
* Used in creating annotation instances from Jandex variant
*/
public DynamicInsertAnnotation(AnnotationInstance annotation, SourceModelBuildingContext modelContext) {
this.value = extractJandexValue( annotation, HibernateAnnotations.DYNAMIC_INSERT, "value", modelContext );
}
@Override
public Class<? extends Annotation> annotationType() {
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)
*/
public DynamicUpdateAnnotation(SourceModelBuildingContext modelContext) {
this.value = true;
}
/**
* Used in creating annotation instances from JDK variant
*/
public DynamicUpdateAnnotation(DynamicUpdate annotation, SourceModelBuildingContext modelContext) {
this.value = annotation.value();
}
/**
* Used in creating annotation instances from Jandex variant
*/
public DynamicUpdateAnnotation(AnnotationInstance annotation, SourceModelBuildingContext modelContext) {
this.value = extractJandexValue( annotation, HibernateAnnotations.DYNAMIC_UPDATE, "value", modelContext );
}
@Override
public Class<? extends Annotation> annotationType() {
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() {
final DynamicInsert dynamicInsertAnnotation = getClassDetails().getDirectAnnotationUsage( DynamicInsert.class );
if ( dynamicInsertAnnotation == null ) {
return false;
}
return dynamicInsertAnnotation.value();
return getClassDetails().getDirectAnnotationUsage( DynamicInsert.class ) != null;
}
private boolean decodeDynamicUpdate() {
final DynamicUpdate dynamicUpdateAnnotation = getClassDetails().getDirectAnnotationUsage( DynamicUpdate.class );
if ( dynamicUpdateAnnotation == null ) {
return false;
}
return dynamicUpdateAnnotation.value();
return getClassDetails().getDirectAnnotationUsage( DynamicUpdate.class ) != null;
}
}

View File

@ -151,7 +151,7 @@ String isDefault();
* 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.annotations.CascadeType.DELETE` in favor of `org.hibernate.annotations.CascadeType#REMOVE`
* Removed the attribute value from `@DynamicInsert` and `@DynamicUpdate`
[WARNING]
===