Class DefaultReactiveDeleteEventListener
- java.lang.Object
-
- org.hibernate.reactive.event.impl.DefaultReactiveDeleteEventListener
-
- All Implemented Interfaces:
java.io.Serializable
,org.hibernate.event.service.spi.JpaBootstrapSensitive
,org.hibernate.event.spi.DeleteEventListener
,org.hibernate.jpa.event.spi.CallbackRegistryConsumer
,ReactiveDeleteEventListener
public class DefaultReactiveDeleteEventListener extends java.lang.Object implements org.hibernate.event.spi.DeleteEventListener, ReactiveDeleteEventListener, org.hibernate.jpa.event.spi.CallbackRegistryConsumer, org.hibernate.event.service.spi.JpaBootstrapSensitive
A reactiveDefaultDeleteEventListener
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultReactiveDeleteEventListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected java.util.concurrent.CompletionStage<java.lang.Void>
cascadeAfterDelete(org.hibernate.event.spi.EventSource session, org.hibernate.persister.entity.EntityPersister persister, java.lang.Object entity, org.hibernate.event.spi.DeleteContext transientEntities)
protected java.util.concurrent.CompletionStage<java.lang.Void>
cascadeBeforeDelete(org.hibernate.event.spi.EventSource session, org.hibernate.persister.entity.EntityPersister persister, java.lang.Object entity, org.hibernate.event.spi.DeleteContext transientEntities)
protected java.util.concurrent.CompletionStage<java.lang.Void>
deleteEntity(org.hibernate.event.spi.EventSource session, java.lang.Object entity, org.hibernate.engine.spi.EntityEntry entityEntry, boolean isCascadeDeleteEnabled, boolean isOrphanRemovalBeforeUpdates, org.hibernate.persister.entity.EntityPersister persister, org.hibernate.event.spi.DeleteContext transientEntities)
Perform the entity deletion.protected java.util.concurrent.CompletionStage<java.lang.Void>
deleteTransientEntity(org.hibernate.event.spi.EventSource session, java.lang.Object entity, org.hibernate.persister.entity.EntityPersister persister, org.hibernate.event.spi.DeleteContext transientEntities)
We encountered a delete request on a transient instance.void
injectCallbackRegistry(org.hibernate.jpa.event.spi.CallbackRegistry callbackRegistry)
void
onDelete(org.hibernate.event.spi.DeleteEvent event)
Deprecated.only the reactive version is supportedvoid
onDelete(org.hibernate.event.spi.DeleteEvent event, org.hibernate.event.spi.DeleteContext transientEntities)
Deprecated.only the reactive version is supportedprotected void
performDetachedEntityDeletionCheck(org.hibernate.event.spi.DeleteEvent event)
Called when we have recognized an attempt to delete a detached entity.java.util.concurrent.CompletionStage<java.lang.Void>
reactiveOnDelete(org.hibernate.event.spi.DeleteEvent event)
Handle the given delete event.java.util.concurrent.CompletionStage<java.lang.Void>
reactiveOnDelete(org.hibernate.event.spi.DeleteEvent event, org.hibernate.event.spi.DeleteContext transientEntities)
Handle the given delete event.void
wasJpaBootstrap(boolean wasJpaBootstrap)
-
-
-
Method Detail
-
injectCallbackRegistry
public void injectCallbackRegistry(org.hibernate.jpa.event.spi.CallbackRegistry callbackRegistry)
- Specified by:
injectCallbackRegistry
in interfaceorg.hibernate.jpa.event.spi.CallbackRegistryConsumer
-
wasJpaBootstrap
public void wasJpaBootstrap(boolean wasJpaBootstrap)
- Specified by:
wasJpaBootstrap
in interfaceorg.hibernate.event.service.spi.JpaBootstrapSensitive
-
onDelete
@Deprecated public void onDelete(org.hibernate.event.spi.DeleteEvent event)
Deprecated.only the reactive version is supportedHandle the given delete event.- Specified by:
onDelete
in interfaceorg.hibernate.event.spi.DeleteEventListener
- Parameters:
event
- The delete event to be handled.- See Also:
reactiveOnDelete(DeleteEvent)
-
onDelete
@Deprecated public void onDelete(org.hibernate.event.spi.DeleteEvent event, org.hibernate.event.spi.DeleteContext transientEntities) throws org.hibernate.HibernateException
Deprecated.only the reactive version is supported- Specified by:
onDelete
in interfaceorg.hibernate.event.spi.DeleteEventListener
- Throws:
org.hibernate.HibernateException
- See Also:
reactiveOnDelete(DeleteEvent, DeleteContext)
-
reactiveOnDelete
public java.util.concurrent.CompletionStage<java.lang.Void> reactiveOnDelete(org.hibernate.event.spi.DeleteEvent event) throws org.hibernate.HibernateException
Handle the given delete event.- Specified by:
reactiveOnDelete
in interfaceReactiveDeleteEventListener
- Parameters:
event
- The delete event to be handled.- Throws:
org.hibernate.HibernateException
-
reactiveOnDelete
public java.util.concurrent.CompletionStage<java.lang.Void> reactiveOnDelete(org.hibernate.event.spi.DeleteEvent event, org.hibernate.event.spi.DeleteContext transientEntities) throws org.hibernate.HibernateException
Handle the given delete event. This is the cascaded form.- Specified by:
reactiveOnDelete
in interfaceReactiveDeleteEventListener
- Parameters:
event
- The delete event.transientEntities
- The cache of entities already deleted- Throws:
org.hibernate.HibernateException
-
performDetachedEntityDeletionCheck
protected void performDetachedEntityDeletionCheck(org.hibernate.event.spi.DeleteEvent event)
Called when we have recognized an attempt to delete a detached entity.This is perfectly valid in Hibernate usage; JPA, however, forbids this. Thus, this is a hook for HEM to affect this behavior.
- Parameters:
event
- The event.
-
deleteTransientEntity
protected java.util.concurrent.CompletionStage<java.lang.Void> deleteTransientEntity(org.hibernate.event.spi.EventSource session, java.lang.Object entity, org.hibernate.persister.entity.EntityPersister persister, org.hibernate.event.spi.DeleteContext transientEntities)
We encountered a delete request on a transient instance.This is a deviation from historical Hibernate (pre-3.2) behavior to align with the JPA spec, which states that transient entities can be passed to remove operation in which case cascades still need to be performed.
- Parameters:
session
- The session which is the source of the evententity
- The entity being delete processedpersister
- The entity persistertransientEntities
- A cache of already visited transient entities (to avoid infinite recursion).
-
deleteEntity
protected java.util.concurrent.CompletionStage<java.lang.Void> deleteEntity(org.hibernate.event.spi.EventSource session, java.lang.Object entity, org.hibernate.engine.spi.EntityEntry entityEntry, boolean isCascadeDeleteEnabled, boolean isOrphanRemovalBeforeUpdates, org.hibernate.persister.entity.EntityPersister persister, org.hibernate.event.spi.DeleteContext transientEntities)
Perform the entity deletion. Well, as with most operations, does not really perform it; just schedules an action/execution with theActionQueue
for execution during flush.- Parameters:
session
- The originating sessionentity
- The entity to deleteentityEntry
- The entity's entry in thePersistenceContext
isCascadeDeleteEnabled
- Is delete cascading enabled?persister
- The entity persister.transientEntities
- A cache of already deleted entities.
-
cascadeBeforeDelete
protected java.util.concurrent.CompletionStage<java.lang.Void> cascadeBeforeDelete(org.hibernate.event.spi.EventSource session, org.hibernate.persister.entity.EntityPersister persister, java.lang.Object entity, org.hibernate.event.spi.DeleteContext transientEntities) throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
-
cascadeAfterDelete
protected java.util.concurrent.CompletionStage<java.lang.Void> cascadeAfterDelete(org.hibernate.event.spi.EventSource session, org.hibernate.persister.entity.EntityPersister persister, java.lang.Object entity, org.hibernate.event.spi.DeleteContext transientEntities) throws org.hibernate.HibernateException
- Throws:
org.hibernate.HibernateException
-
-