diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadeStyles.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadeStyles.java index c698a478ea..7d38ceb185 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadeStyles.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadeStyles.java @@ -180,7 +180,7 @@ public final class CascadeStyles { public static final CascadeStyle DELETE = new BaseCascadeStyle() { @Override public boolean doCascade(CascadingAction action) { - return action == CascadingActions.DELETE + return action == CascadingActions.REMOVE || action == CascadingActions.CHECK_ON_FLUSH; } @@ -196,7 +196,7 @@ public final class CascadeStyles { public static final CascadeStyle DELETE_ORPHAN = new BaseCascadeStyle() { @Override public boolean doCascade(CascadingAction action) { - return action == CascadingActions.DELETE + return action == CascadingActions.REMOVE || action == CascadingActions.SAVE_UPDATE || action == CascadingActions.PERSIST_ON_FLUSH || action == CascadingActions.CHECK_ON_FLUSH; @@ -204,7 +204,7 @@ public final class CascadeStyles { @Override public boolean reallyDoCascade(CascadingAction action) { - return action == CascadingActions.DELETE + return action == CascadingActions.REMOVE || action == CascadingActions.CHECK_ON_FLUSH; } diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingActions.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingActions.java index 05acd09083..2d8e435453 100644 --- a/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingActions.java +++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/CascadingActions.java @@ -44,9 +44,9 @@ public class CascadingActions { } /** - * @see org.hibernate.Session#delete(Object) + * @see org.hibernate.Session#remove(Object) */ - public static final CascadingAction DELETE = new BaseCascadingAction<>() { + public static final CascadingAction REMOVE = new BaseCascadingAction<>() { @Override public void cascade( EventSource session, @@ -79,6 +79,14 @@ public class CascadingActions { } }; + /** + * @see org.hibernate.Session#delete(Object) + * + * @deprecated Use {@link #REMOVE} + */ + @Deprecated(since = "6.6") + public static final CascadingAction DELETE = REMOVE; + /** * @see org.hibernate.Session#lock(Object, LockMode) */ diff --git a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultDeleteEventListener.java b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultDeleteEventListener.java index 188a01ca34..0c5c4eaad3 100644 --- a/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultDeleteEventListener.java +++ b/hibernate-core/src/main/java/org/hibernate/event/internal/DefaultDeleteEventListener.java @@ -507,7 +507,7 @@ public class DefaultDeleteEventListener implements DeleteEventListener, Callback try { // cascade-delete to collections BEFORE the collection owner is deleted Cascade.cascade( - CascadingActions.DELETE, + CascadingActions.REMOVE, CascadePoint.AFTER_INSERT_BEFORE_DELETE, session, persister, @@ -534,7 +534,7 @@ public class DefaultDeleteEventListener implements DeleteEventListener, Callback try { // cascade-delete to many-to-one AFTER the parent was deleted Cascade.cascade( - CascadingActions.DELETE, + CascadingActions.REMOVE, CascadePoint.BEFORE_INSERT_AFTER_DELETE, session, persister, diff --git a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java index 2ed7fdd328..ebaca4dafe 100644 --- a/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java +++ b/hibernate-core/src/main/java/org/hibernate/tuple/entity/EntityMetamodel.java @@ -363,7 +363,7 @@ public class EntityMetamodel implements Serializable { if ( cascadeStyles[i] != CascadeStyles.NONE ) { foundCascade = true; } - if ( cascadeStyles[i].doCascade(CascadingActions.DELETE) ) { + if ( cascadeStyles[i].doCascade(CascadingActions.REMOVE) ) { foundCascadeDelete = true; }