HHH-18195 Remove @SelectBeforeUpdate
This commit is contained in:
parent
e3344e0068
commit
e67967a24e
|
@ -21,10 +21,6 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||||
* only some of the attributes of the entity. However, there is a cost
|
* only some of the attributes of the entity. However, there is a cost
|
||||||
* associated with generating the SQL at runtime.
|
* associated with generating the SQL at runtime.
|
||||||
* <p>
|
* <p>
|
||||||
* When detached entities are reattached using
|
|
||||||
* {@link org.hibernate.Session#update(Object)}, the entity must also be
|
|
||||||
* annotated {@link SelectBeforeUpdate} for this annotation to have any
|
|
||||||
* effect.
|
|
||||||
*
|
*
|
||||||
* @author Steve Ebersole
|
* @author Steve Ebersole
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
||||||
* See the lgpl.txt file in the root directory or <http://www.gnu.org/licenses/lgpl-2.1.html>.
|
|
||||||
*/
|
|
||||||
package org.hibernate.annotations;
|
|
||||||
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
import static java.lang.annotation.ElementType.TYPE;
|
|
||||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specifies that the current persistent state of a detached entity instance
|
|
||||||
* should be fetched from the database when the entity is reattached using
|
|
||||||
* {@link org.hibernate.Session#update(Object)}.
|
|
||||||
*
|
|
||||||
* @deprecated Since {@link org.hibernate.Session#update(Object)} is deprecated
|
|
||||||
*
|
|
||||||
* @author Steve Ebersole
|
|
||||||
*/
|
|
||||||
@Target( TYPE )
|
|
||||||
@Retention( RUNTIME )
|
|
||||||
@Deprecated(since = "6.2")
|
|
||||||
public @interface SelectBeforeUpdate {
|
|
||||||
/**
|
|
||||||
* @deprecated When {@code false}, this annotation has no effect.
|
|
||||||
*/
|
|
||||||
@Deprecated(since = "6.0")
|
|
||||||
boolean value() default true;
|
|
||||||
}
|
|
|
@ -48,7 +48,6 @@ import org.hibernate.annotations.SQLSelect;
|
||||||
import org.hibernate.annotations.SQLUpdate;
|
import org.hibernate.annotations.SQLUpdate;
|
||||||
import org.hibernate.annotations.SecondaryRow;
|
import org.hibernate.annotations.SecondaryRow;
|
||||||
import org.hibernate.annotations.SecondaryRows;
|
import org.hibernate.annotations.SecondaryRows;
|
||||||
import org.hibernate.annotations.SelectBeforeUpdate;
|
|
||||||
import org.hibernate.annotations.SoftDelete;
|
import org.hibernate.annotations.SoftDelete;
|
||||||
import org.hibernate.annotations.Subselect;
|
import org.hibernate.annotations.Subselect;
|
||||||
import org.hibernate.annotations.Synchronize;
|
import org.hibernate.annotations.Synchronize;
|
||||||
|
@ -1275,9 +1274,6 @@ public class EntityBinder {
|
||||||
if ( persistentClass.useDynamicUpdate() && annotatedClass.hasAnnotationUsage( SQLUpdate.class, getSourceModelContext() ) ) {
|
if ( persistentClass.useDynamicUpdate() && annotatedClass.hasAnnotationUsage( SQLUpdate.class, getSourceModelContext() ) ) {
|
||||||
throw new AnnotationException( "Entity '" + name + "' is annotated both '@DynamicUpdate' and '@SQLUpdate'" );
|
throw new AnnotationException( "Entity '" + name + "' is annotated both '@DynamicUpdate' and '@SQLUpdate'" );
|
||||||
}
|
}
|
||||||
|
|
||||||
final SelectBeforeUpdate selectBeforeUpdateAnn = annotatedClass.getAnnotationUsage( SelectBeforeUpdate.class, getSourceModelContext() );
|
|
||||||
persistentClass.setSelectBeforeUpdate( selectBeforeUpdateAnn != null && selectBeforeUpdateAnn.value() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindOptimisticLocking() {
|
private void bindOptimisticLocking() {
|
||||||
|
|
|
@ -513,10 +513,6 @@ public interface HibernateAnnotations {
|
||||||
SecondaryRowAnnotation.class,
|
SecondaryRowAnnotation.class,
|
||||||
SECONDARY_ROWS
|
SECONDARY_ROWS
|
||||||
);
|
);
|
||||||
OrmAnnotationDescriptor<SelectBeforeUpdate,SelectBeforeUpdateAnnotation> SELECT_BEFORE_UPDATE = new OrmAnnotationDescriptor<>(
|
|
||||||
SelectBeforeUpdate.class,
|
|
||||||
SelectBeforeUpdateAnnotation.class
|
|
||||||
);
|
|
||||||
OrmAnnotationDescriptor<SoftDelete,SoftDeleteAnnotation> SOFT_DELETE = new OrmAnnotationDescriptor<>(
|
OrmAnnotationDescriptor<SoftDelete,SoftDeleteAnnotation> SOFT_DELETE = new OrmAnnotationDescriptor<>(
|
||||||
SoftDelete.class,
|
SoftDelete.class,
|
||||||
SoftDeleteAnnotation.class
|
SoftDeleteAnnotation.class
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
/*
|
|
||||||
* Hibernate, Relational Persistence for Idiomatic Java
|
|
||||||
*
|
|
||||||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later.
|
|
||||||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html.
|
|
||||||
*/
|
|
||||||
package org.hibernate.boot.models.annotations.internal;
|
|
||||||
|
|
||||||
import java.lang.annotation.Annotation;
|
|
||||||
|
|
||||||
import org.hibernate.annotations.SelectBeforeUpdate;
|
|
||||||
import org.hibernate.boot.models.HibernateAnnotations;
|
|
||||||
import org.hibernate.models.spi.SourceModelBuildingContext;
|
|
||||||
|
|
||||||
import org.jboss.jandex.AnnotationInstance;
|
|
||||||
|
|
||||||
import static org.hibernate.boot.models.internal.OrmAnnotationHelper.extractJandexValue;
|
|
||||||
|
|
||||||
@SuppressWarnings({ "ClassExplicitlyAnnotation", "unused" })
|
|
||||||
@jakarta.annotation.Generated("org.hibernate.orm.build.annotations.ClassGeneratorProcessor")
|
|
||||||
public class SelectBeforeUpdateAnnotation implements SelectBeforeUpdate {
|
|
||||||
private boolean value;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used in creating dynamic annotation instances (e.g. from XML)
|
|
||||||
*/
|
|
||||||
public SelectBeforeUpdateAnnotation(SourceModelBuildingContext modelContext) {
|
|
||||||
this.value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used in creating annotation instances from JDK variant
|
|
||||||
*/
|
|
||||||
public SelectBeforeUpdateAnnotation(SelectBeforeUpdate annotation, SourceModelBuildingContext modelContext) {
|
|
||||||
this.value = annotation.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used in creating annotation instances from Jandex variant
|
|
||||||
*/
|
|
||||||
public SelectBeforeUpdateAnnotation(AnnotationInstance annotation, SourceModelBuildingContext modelContext) {
|
|
||||||
this.value = extractJandexValue( annotation, HibernateAnnotations.SELECT_BEFORE_UPDATE, "value", modelContext );
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class<? extends Annotation> annotationType() {
|
|
||||||
return SelectBeforeUpdate.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean value() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void value(boolean value) {
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -21,7 +21,6 @@ import org.hibernate.annotations.ResultCheckStyle;
|
||||||
import org.hibernate.annotations.SQLDelete;
|
import org.hibernate.annotations.SQLDelete;
|
||||||
import org.hibernate.annotations.SQLInsert;
|
import org.hibernate.annotations.SQLInsert;
|
||||||
import org.hibernate.annotations.SQLUpdate;
|
import org.hibernate.annotations.SQLUpdate;
|
||||||
import org.hibernate.annotations.SelectBeforeUpdate;
|
|
||||||
import org.hibernate.annotations.Synchronize;
|
import org.hibernate.annotations.Synchronize;
|
||||||
import org.hibernate.boot.model.CustomSql;
|
import org.hibernate.boot.model.CustomSql;
|
||||||
import org.hibernate.boot.model.naming.EntityNaming;
|
import org.hibernate.boot.model.naming.EntityNaming;
|
||||||
|
@ -63,7 +62,6 @@ public class EntityTypeMetadataImpl
|
||||||
private final String proxy;
|
private final String proxy;
|
||||||
private final int batchSize;
|
private final int batchSize;
|
||||||
private final String discriminatorMatchValue;
|
private final String discriminatorMatchValue;
|
||||||
private final boolean isSelectBeforeUpdate;
|
|
||||||
private final boolean isDynamicInsert;
|
private final boolean isDynamicInsert;
|
||||||
private final boolean isDynamicUpdate;
|
private final boolean isDynamicUpdate;
|
||||||
private final Map<String,CustomSql> customInsertMap;
|
private final Map<String,CustomSql> customInsertMap;
|
||||||
|
@ -102,7 +100,6 @@ public class EntityTypeMetadataImpl
|
||||||
this.cacheable = determineCacheability( classDetails, modelContext );
|
this.cacheable = determineCacheability( classDetails, modelContext );
|
||||||
this.synchronizedTableNames = determineSynchronizedTableNames();
|
this.synchronizedTableNames = determineSynchronizedTableNames();
|
||||||
this.batchSize = determineBatchSize();
|
this.batchSize = determineBatchSize();
|
||||||
this.isSelectBeforeUpdate = decodeSelectBeforeUpdate();
|
|
||||||
this.isDynamicInsert = decodeDynamicInsert();
|
this.isDynamicInsert = decodeDynamicInsert();
|
||||||
this.isDynamicUpdate = decodeDynamicUpdate();
|
this.isDynamicUpdate = decodeDynamicUpdate();
|
||||||
this.customInsertMap = extractCustomSql( classDetails, SQLInsert.class );
|
this.customInsertMap = extractCustomSql( classDetails, SQLInsert.class );
|
||||||
|
@ -172,7 +169,6 @@ public class EntityTypeMetadataImpl
|
||||||
this.cacheable = determineCacheability( classDetails, modelContext );
|
this.cacheable = determineCacheability( classDetails, modelContext );
|
||||||
this.synchronizedTableNames = determineSynchronizedTableNames();
|
this.synchronizedTableNames = determineSynchronizedTableNames();
|
||||||
this.batchSize = determineBatchSize();
|
this.batchSize = determineBatchSize();
|
||||||
this.isSelectBeforeUpdate = decodeSelectBeforeUpdate();
|
|
||||||
this.isDynamicInsert = decodeDynamicInsert();
|
this.isDynamicInsert = decodeDynamicInsert();
|
||||||
this.isDynamicUpdate = decodeDynamicUpdate();
|
this.isDynamicUpdate = decodeDynamicUpdate();
|
||||||
this.customInsertMap = extractCustomSql( classDetails, SQLInsert.class );
|
this.customInsertMap = extractCustomSql( classDetails, SQLInsert.class );
|
||||||
|
@ -254,11 +250,6 @@ public class EntityTypeMetadataImpl
|
||||||
return batchSize;
|
return batchSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isSelectBeforeUpdate() {
|
|
||||||
return isSelectBeforeUpdate;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isDynamicInsert() {
|
public boolean isDynamicInsert() {
|
||||||
return isDynamicInsert;
|
return isDynamicInsert;
|
||||||
|
@ -412,15 +403,6 @@ public class EntityTypeMetadataImpl
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean decodeSelectBeforeUpdate() {
|
|
||||||
//noinspection deprecation
|
|
||||||
final SelectBeforeUpdate selectBeforeUpdateAnnotation = getClassDetails().getDirectAnnotationUsage( SelectBeforeUpdate.class );
|
|
||||||
if ( selectBeforeUpdateAnnotation == null ) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return selectBeforeUpdateAnnotation.value();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean decodeDynamicInsert() {
|
private boolean decodeDynamicInsert() {
|
||||||
final DynamicInsert dynamicInsertAnnotation = getClassDetails().getDirectAnnotationUsage( DynamicInsert.class );
|
final DynamicInsert dynamicInsertAnnotation = getClassDetails().getDirectAnnotationUsage( DynamicInsert.class );
|
||||||
if ( dynamicInsertAnnotation == null ) {
|
if ( dynamicInsertAnnotation == null ) {
|
||||||
|
|
|
@ -58,14 +58,6 @@ public interface EntityTypeMetadata extends IdentifiableTypeMetadata, EntityNami
|
||||||
*/
|
*/
|
||||||
int getBatchSize();
|
int getBatchSize();
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether to perform a select prior to performing a {@linkplain org.hibernate.Session#update}
|
|
||||||
*
|
|
||||||
* @deprecated Because {@linkplain org.hibernate.Session#update} itself is deprecated
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
boolean isSelectBeforeUpdate();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether to perform dynamic inserts.
|
* Whether to perform dynamic inserts.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue