diff --git a/hibernate-core/src/main/java/org/hibernate/Session.java b/hibernate-core/src/main/java/org/hibernate/Session.java index ca1c253137..60314d875a 100644 --- a/hibernate-core/src/main/java/org/hibernate/Session.java +++ b/hibernate-core/src/main/java/org/hibernate/Session.java @@ -680,35 +680,6 @@ public interface Session extends SharedSessionContract, EntityManager { */ void persist(String entityName, Object object); - /** - * Remove a persistent instance from the datastore. The argument may be - * an instance associated with the receiving {@code Session} or a transient - * instance with an identifier associated with existing persistent state. - * This operation cascades to associated instances if the association is - * mapped with {@link jakarta.persistence.CascadeType#REMOVE}. - * - * @param object the instance to be removed - * - * @deprecated use {@link #remove(Object)} - */ - @Deprecated(since = "6.0") - void delete(Object object); - - /** - * Remove a persistent instance from the datastore. The second argument may - * be an instance associated with the receiving {@code Session} or a transient - * instance with an identifier associated with existing persistent state. - * This operation cascades to associated instances if the association is - * mapped with {@link jakarta.persistence.CascadeType#REMOVE}. - * - * @param entityName the entity name for the instance to be removed. - * @param object the instance to be removed - * - * @deprecated use {@link #remove(Object)} - */ - @Deprecated(since = "6.0") - void delete(String entityName, Object object); - /** * Obtain the specified lock level on the given managed instance associated * with this session. This operation may be used to: diff --git a/hibernate-core/src/main/java/org/hibernate/annotations/CascadeType.java b/hibernate-core/src/main/java/org/hibernate/annotations/CascadeType.java index 4f8b976895..a0a2c486c1 100644 --- a/hibernate-core/src/main/java/org/hibernate/annotations/CascadeType.java +++ b/hibernate-core/src/main/java/org/hibernate/annotations/CascadeType.java @@ -82,19 +82,6 @@ public enum CascadeType { */ LOCK, - /** - * A cascade type for the {@code delete()} operation. - *
- * This is actually a synonym for {@link #REMOVE}.
- *
- * @see org.hibernate.Session#delete(Object)
- *
- * @deprecated since {@link org.hibernate.Session#delete(Object)}
- * is deprecated
- */
- @Deprecated
- DELETE,
-
/**
* A cascade type for the {@code replicate()} operation.
*
diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/BinderHelper.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/BinderHelper.java
index 62da318fc7..e10bc0f5f8 100644
--- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/BinderHelper.java
+++ b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/BinderHelper.java
@@ -1009,11 +1009,7 @@ public class BinderHelper {
case DETACH:
cascade.append( "," ).append( "evict" );
break;
- case DELETE:
case REMOVE:
- if ( CascadeType.DELETE == cascadeType ) {
- warnAboutDeprecatedCascadeType( CascadeType.DELETE, CascadeType.REMOVE );
- }
cascade.append( "," ).append( "delete" );
break;
case DELETE_ORPHAN:
diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java
index dfc8561de2..2d18ed8877 100644
--- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java
+++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionDelegatorBaseImpl.java
@@ -922,16 +922,6 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
delegate.persist( entityName, object );
}
- @Override
- public void delete(Object object) {
- delegate.delete( object );
- }
-
- @Override
- public void delete(String entityName, Object object) {
- delegate.delete( entityName, object );
- }
-
@Override
public void lock(Object object, LockMode lockMode) {
delegate.lock( object, lockMode );
@@ -1212,11 +1202,6 @@ public class SessionDelegatorBaseImpl implements SessionImplementor {
delegate.refresh( entityName, object, refreshedAlready );
}
- @Override
- public void delete(String entityName, Object child, boolean isCascadeDeleteEnabled, DeleteContext transientEntities) {
- delegate.delete( entityName, child, isCascadeDeleteEnabled, transientEntities );
- }
-
@Override
public void removeOrphanBeforeUpdates(String entityName, Object child) {
delegate.removeOrphanBeforeUpdates( entityName, child );
diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java
index 05f75f6953..e4e055bcec 100644
--- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java
+++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionImplementor.java
@@ -11,7 +11,6 @@ import org.hibernate.LockOptions;
import org.hibernate.Session;
import org.hibernate.engine.jdbc.LobCreationContext;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
-import org.hibernate.event.spi.DeleteContext;
import org.hibernate.event.spi.MergeContext;
import org.hibernate.event.spi.PersistContext;
import org.hibernate.event.spi.RefreshContext;
@@ -128,12 +127,6 @@ public interface SessionImplementor extends Session, SharedSessionContractImplem
@Deprecated
void refresh(String entityName, Object object, RefreshContext refreshedAlready) throws HibernateException;
- /**
- * @deprecated OperationalContext should cover this overload I believe
- */
- @Deprecated
- void delete(String entityName, Object child, boolean isCascadeDeleteEnabled, DeleteContext transientEntities);
-
/**
* @deprecated OperationalContext should cover this overload I believe
*/
diff --git a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionLazyDelegator.java b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionLazyDelegator.java
index 98fa0b66af..80b991ccfb 100644
--- a/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionLazyDelegator.java
+++ b/hibernate-core/src/main/java/org/hibernate/engine/spi/SessionLazyDelegator.java
@@ -259,18 +259,6 @@ public class SessionLazyDelegator implements Session {
this.lazySession.get().persist( entityName, object );
}
- @Override
- @Deprecated
- public void delete(Object object) {
- this.lazySession.get().delete( object );
- }
-
- @Override
- @Deprecated
- public void delete(String entityName, Object object) {
- this.lazySession.get().delete( entityName, object );
- }
-
@Override
public void lock(Object object, LockMode lockMode) {
this.lazySession.get().lock( object, lockMode );
diff --git a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java
index 28f25da657..a3888ded32 100644
--- a/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java
+++ b/hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java
@@ -839,18 +839,6 @@ public class SessionImpl
// delete() operations ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- @Override @Deprecated
- public void delete(Object object) throws HibernateException {
- checkOpen();
- fireDelete( new DeleteEvent( object, this ) );
- }
-
- @Override @Deprecated
- public void delete(String entityName, Object object) throws HibernateException {
- checkOpen();
- fireDelete( new DeleteEvent( entityName, object, this ) );
- }
-
@Override
public void delete(String entityName, Object object, boolean isCascadeDeleteEnabled, DeleteContext transientEntities)
throws HibernateException {
@@ -2383,9 +2371,8 @@ public class SessionImpl
@Override
public void remove(Object entity) {
checkOpen();
-
try {
- delete( entity );
+ fireDelete( new DeleteEvent( entity, this ) );
}
catch (MappingException e) {
throw getExceptionConverter().convert( new IllegalArgumentException( e.getMessage(), e ) );
diff --git a/hibernate-core/src/test/java/org/hibernate/event/service/internal/NewlyInstantiatdCollectionSkipDeleteOrphanTest.java b/hibernate-core/src/test/java/org/hibernate/event/service/internal/NewlyInstantiatdCollectionSkipDeleteOrphanTest.java
index 7a7971b2c4..d8a77d1e7c 100644
--- a/hibernate-core/src/test/java/org/hibernate/event/service/internal/NewlyInstantiatdCollectionSkipDeleteOrphanTest.java
+++ b/hibernate-core/src/test/java/org/hibernate/event/service/internal/NewlyInstantiatdCollectionSkipDeleteOrphanTest.java
@@ -25,6 +25,7 @@ import jakarta.persistence.Version;
import org.hibernate.FlushMode;
import org.hibernate.Transaction;
import org.hibernate.annotations.Cascade;
+import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.testing.TestForIssue;
@@ -329,7 +330,7 @@ public class NewlyInstantiatdCollectionSkipDeleteOrphanTest {
jakarta.persistence.CascadeType.REMOVE
}, orphanRemoval = true)
@Cascade({
- org.hibernate.annotations.CascadeType.DELETE,
+ CascadeType.REMOVE,
org.hibernate.annotations.CascadeType.LOCK,
org.hibernate.annotations.CascadeType.REPLICATE
})
@@ -440,7 +441,7 @@ public class NewlyInstantiatdCollectionSkipDeleteOrphanTest {
jakarta.persistence.CascadeType.REMOVE
}, orphanRemoval = true)
@Cascade({
- org.hibernate.annotations.CascadeType.DELETE,
+ CascadeType.REMOVE,
org.hibernate.annotations.CascadeType.LOCK,
org.hibernate.annotations.CascadeType.REPLICATE
})
diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/ops/OneToManyMappedByCascadeDeleteTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/ops/OneToManyMappedByCascadeDeleteTest.java
index 7393350452..53d99dbf54 100644
--- a/hibernate-core/src/test/java/org/hibernate/orm/test/ops/OneToManyMappedByCascadeDeleteTest.java
+++ b/hibernate-core/src/test/java/org/hibernate/orm/test/ops/OneToManyMappedByCascadeDeleteTest.java
@@ -80,7 +80,7 @@ public class OneToManyMappedByCascadeDeleteTest {
@Id
private Integer id;
@OneToMany(targetEntity = Child.class, mappedBy = "parent", fetch = FetchType.LAZY)
- @Cascade(CascadeType.DELETE)
+ @Cascade(CascadeType.REMOVE)
private List