Class DefaultReactiveDeleteEventListener
java.lang.Object
org.hibernate.reactive.event.impl.DefaultReactiveDeleteEventListener
- All Implemented Interfaces:
Serializable,org.hibernate.event.service.spi.JpaBootstrapSensitive,org.hibernate.event.spi.DeleteEventListener,org.hibernate.jpa.event.spi.CallbackRegistryConsumer,ReactiveDeleteEventListener
public class DefaultReactiveDeleteEventListener
extends Object
implements org.hibernate.event.spi.DeleteEventListener, ReactiveDeleteEventListener, org.hibernate.jpa.event.spi.CallbackRegistryConsumer, org.hibernate.event.service.spi.JpaBootstrapSensitive
A reactive
DefaultDeleteEventListener.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected CompletionStage<Void>cascadeAfterDelete(org.hibernate.event.spi.EventSource session, org.hibernate.persister.entity.EntityPersister persister, Object entity, org.hibernate.event.spi.DeleteContext transientEntities) protected CompletionStage<Void>cascadeBeforeDelete(org.hibernate.event.spi.EventSource session, org.hibernate.persister.entity.EntityPersister persister, Object entity, org.hibernate.event.spi.DeleteContext transientEntities) protected CompletionStage<Void>deleteEntity(org.hibernate.event.spi.EventSource session, 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 CompletionStage<Void>deleteTransientEntity(org.hibernate.event.spi.EventSource session, Object entity, org.hibernate.persister.entity.EntityPersister persister, org.hibernate.event.spi.DeleteContext transientEntities) We encountered a delete request on a transient instance.voidinjectCallbackRegistry(org.hibernate.jpa.event.spi.CallbackRegistry callbackRegistry) voidonDelete(org.hibernate.event.spi.DeleteEvent event) Deprecated.only the reactive version is supportedvoidonDelete(org.hibernate.event.spi.DeleteEvent event, org.hibernate.event.spi.DeleteContext transientEntities) Deprecated.only the reactive version is supportedprotected voidperformDetachedEntityDeletionCheck(org.hibernate.event.spi.DeleteEvent event) Called when we have recognized an attempt to delete a detached entity.reactiveOnDelete(org.hibernate.event.spi.DeleteEvent event) Handle the given delete event.reactiveOnDelete(org.hibernate.event.spi.DeleteEvent event, org.hibernate.event.spi.DeleteContext transientEntities) Handle the given delete event.voidwasJpaBootstrap(boolean wasJpaBootstrap)
-
Constructor Details
-
DefaultReactiveDeleteEventListener
public DefaultReactiveDeleteEventListener()
-
-
Method Details
-
injectCallbackRegistry
public void injectCallbackRegistry(org.hibernate.jpa.event.spi.CallbackRegistry callbackRegistry) - Specified by:
injectCallbackRegistryin interfaceorg.hibernate.jpa.event.spi.CallbackRegistryConsumer
-
wasJpaBootstrap
public void wasJpaBootstrap(boolean wasJpaBootstrap) - Specified by:
wasJpaBootstrapin interfaceorg.hibernate.event.service.spi.JpaBootstrapSensitive
-
onDelete
Deprecated.only the reactive version is supportedHandle the given delete event.- Specified by:
onDeletein interfaceorg.hibernate.event.spi.DeleteEventListener- Parameters:
event- The delete event to be handled.- See Also:
-
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:
onDeletein interfaceorg.hibernate.event.spi.DeleteEventListener- Throws:
org.hibernate.HibernateException- See Also:
-
reactiveOnDelete
public CompletionStage<Void> reactiveOnDelete(org.hibernate.event.spi.DeleteEvent event) throws org.hibernate.HibernateException Handle the given delete event.- Specified by:
reactiveOnDeletein interfaceReactiveDeleteEventListener- Parameters:
event- The delete event to be handled.- Throws:
org.hibernate.HibernateException
-
reactiveOnDelete
public CompletionStage<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:
reactiveOnDeletein 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 CompletionStage<Void> deleteTransientEntity(org.hibernate.event.spi.EventSource session, 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 CompletionStage<Void> deleteEntity(org.hibernate.event.spi.EventSource session, 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 theActionQueuefor execution during flush.- Parameters:
session- The originating sessionentity- The entity to deleteentityEntry- The entity's entry in thePersistenceContextisCascadeDeleteEnabled- Is delete cascading enabled?persister- The entity persister.transientEntities- A cache of already deleted entities.
-
cascadeBeforeDelete
protected CompletionStage<Void> cascadeBeforeDelete(org.hibernate.event.spi.EventSource session, org.hibernate.persister.entity.EntityPersister persister, Object entity, org.hibernate.event.spi.DeleteContext transientEntities) throws org.hibernate.HibernateException - Throws:
org.hibernate.HibernateException
-
cascadeAfterDelete
protected CompletionStage<Void> cascadeAfterDelete(org.hibernate.event.spi.EventSource session, org.hibernate.persister.entity.EntityPersister persister, Object entity, org.hibernate.event.spi.DeleteContext transientEntities) throws org.hibernate.HibernateException - Throws:
org.hibernate.HibernateException
-