remove a deprecated operation

This commit is contained in:
Gavin King 2024-12-12 23:25:16 +01:00
parent 399a1d0071
commit 9823fccfe8
2 changed files with 11 additions and 23 deletions

View File

@ -17,6 +17,7 @@ import java.util.Properties;
import org.hibernate.AssertionFailure; import org.hibernate.AssertionFailure;
import org.hibernate.FetchMode; import org.hibernate.FetchMode;
import org.hibernate.annotations.CascadeType; import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.OnDeleteAction;
import org.hibernate.annotations.SourceType; import org.hibernate.annotations.SourceType;
import org.hibernate.boot.MappingException; import org.hibernate.boot.MappingException;
import org.hibernate.boot.jaxb.Origin; import org.hibernate.boot.jaxb.Origin;
@ -562,7 +563,7 @@ public class ModelBinder {
keyBinding.makeNationalized(); keyBinding.makeNationalized();
} }
entityDescriptor.setKey( keyBinding ); entityDescriptor.setKey( keyBinding );
keyBinding.setCascadeDeleteEnabled( entitySource.isCascadeDeleteEnabled() ); keyBinding.setOnDeleteAction( getOnDeleteAction( entitySource.isCascadeDeleteEnabled() ) );
relationalObjectBinder.bindColumns( relationalObjectBinder.bindColumns(
mappingDocument, mappingDocument,
entitySource.getPrimaryKeyColumnSources(), entitySource.getPrimaryKeyColumnSources(),
@ -593,7 +594,6 @@ public class ModelBinder {
bindJoinedSubclassEntities( entitySource, entityDescriptor ); bindJoinedSubclassEntities( entitySource, entityDescriptor );
} }
private void bindUnionSubclassEntities( private void bindUnionSubclassEntities(
EntitySource entitySource, EntitySource entitySource,
PersistentClass superEntityDescriptor) { PersistentClass superEntityDescriptor) {
@ -1622,7 +1622,7 @@ public class ModelBinder {
} }
secondaryTableJoin.setKey( keyBinding ); secondaryTableJoin.setKey( keyBinding );
keyBinding.setCascadeDeleteEnabled( secondaryTableSource.isCascadeDeleteEnabled() ); keyBinding.setOnDeleteAction( getOnDeleteAction( secondaryTableSource.isCascadeDeleteEnabled() ) );
// NOTE : no Type info to bind... // NOTE : no Type info to bind...
@ -1972,7 +1972,7 @@ public class ModelBinder {
setForeignKeyName( oneToOneBinding, oneToOneSource.getExplicitForeignKeyName() ); setForeignKeyName( oneToOneBinding, oneToOneSource.getExplicitForeignKeyName() );
} }
oneToOneBinding.setCascadeDeleteEnabled( oneToOneSource.isCascadeDeleteEnabled() ); oneToOneBinding.setOnDeleteAction( getOnDeleteAction( oneToOneSource.isCascadeDeleteEnabled() ) );
} }
private Property createManyToOneAttribute( private Property createManyToOneAttribute(
@ -2121,7 +2121,7 @@ public class ModelBinder {
} }
} }
manyToOneBinding.setCascadeDeleteEnabled( manyToOneSource.isCascadeDeleteEnabled() ); manyToOneBinding.setOnDeleteAction( getOnDeleteAction( manyToOneSource.isCascadeDeleteEnabled() ) );
} }
private static void setForeignKeyName(SimpleValue manyToOneBinding, String foreignKeyName) { private static void setForeignKeyName(SimpleValue manyToOneBinding, String foreignKeyName) {
@ -3203,8 +3203,8 @@ public class ModelBinder {
keyVal keyVal
); );
setForeignKeyName( key, keySource.getExplicitForeignKeyName() ); setForeignKeyName( key, keySource.getExplicitForeignKeyName() );
key.setCascadeDeleteEnabled( getPluralAttributeSource().getKeySource().isCascadeDeleteEnabled() ); key.setOnDeleteAction( getOnDeleteAction( getPluralAttributeSource().getKeySource().isCascadeDeleteEnabled() ) );
//
// final ImplicitJoinColumnNameSource.Nature implicitNamingNature; // final ImplicitJoinColumnNameSource.Nature implicitNamingNature;
// if ( getPluralAttributeSource().getElementSource() instanceof PluralAttributeElementSourceManyToMany // if ( getPluralAttributeSource().getElementSource() instanceof PluralAttributeElementSourceManyToMany
// || getPluralAttributeSource().getElementSource() instanceof PluralAttributeElementSourceOneToMany ) { // || getPluralAttributeSource().getElementSource() instanceof PluralAttributeElementSourceOneToMany ) {
@ -4069,4 +4069,8 @@ public class ModelBinder {
} }
return builder.toString(); return builder.toString();
} }
private static OnDeleteAction getOnDeleteAction(boolean entitySource) {
return entitySource ? OnDeleteAction.CASCADE : OnDeleteAction.NO_ACTION;
}
} }

View File

@ -35,8 +35,6 @@ import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.dialect.Dialect; import org.hibernate.dialect.Dialect;
import org.hibernate.generator.Generator; import org.hibernate.generator.Generator;
import org.hibernate.generator.GeneratorCreationContext; import org.hibernate.generator.GeneratorCreationContext;
import org.hibernate.internal.CoreLogging;
import org.hibernate.internal.CoreMessageLogger;
import org.hibernate.models.spi.MemberDetails; import org.hibernate.models.spi.MemberDetails;
import org.hibernate.models.spi.TypeDetails; import org.hibernate.models.spi.TypeDetails;
import org.hibernate.resource.beans.spi.ManagedBeanRegistry; import org.hibernate.resource.beans.spi.ManagedBeanRegistry;
@ -72,7 +70,6 @@ import static org.hibernate.internal.util.collections.ArrayHelper.toBooleanArray
* @author Yanming Zhou * @author Yanming Zhou
*/ */
public abstract class SimpleValue implements KeyValue { public abstract class SimpleValue implements KeyValue {
private static final CoreMessageLogger log = CoreLogging.messageLogger( SimpleValue.class );
@Deprecated(since = "7.0", forRemoval = true) @Deprecated(since = "7.0", forRemoval = true)
public static final String DEFAULT_ID_GEN_STRATEGY = ASSIGNED_GENERATOR_NAME; public static final String DEFAULT_ID_GEN_STRATEGY = ASSIGNED_GENERATOR_NAME;
@ -171,24 +168,11 @@ public abstract class SimpleValue implements KeyValue {
return onDeleteAction; return onDeleteAction;
} }
/**
* @deprecated use {@link #getOnDeleteAction()}
*/
@Deprecated(since = "6.2")
@Override @Override
public boolean isCascadeDeleteEnabled() { public boolean isCascadeDeleteEnabled() {
return onDeleteAction == OnDeleteAction.CASCADE; return onDeleteAction == OnDeleteAction.CASCADE;
} }
/**
* @deprecated use {@link #setOnDeleteAction(OnDeleteAction)}
*/
@Deprecated(since = "6.2")
public void setCascadeDeleteEnabled(boolean cascadeDeleteEnabled) {
this.onDeleteAction = cascadeDeleteEnabled ? OnDeleteAction.CASCADE : OnDeleteAction.NO_ACTION;
}
public void addColumn(Column column) { public void addColumn(Column column) {
addColumn( column, true, true ); addColumn( column, true, true );
} }