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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    cascadeAfterDelete(org.hibernate.event.spi.EventSource session, org.hibernate.persister.entity.EntityPersister persister, Object entity, org.hibernate.event.spi.DeleteContext transientEntities)
     
    cascadeBeforeDelete(org.hibernate.event.spi.EventSource session, org.hibernate.persister.entity.EntityPersister persister, Object entity, org.hibernate.event.spi.DeleteContext transientEntities)
     
    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.
    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.
    void
    injectCallbackRegistry(org.hibernate.jpa.event.spi.CallbackRegistry callbackRegistry)
     
    void
    onDelete(org.hibernate.event.spi.DeleteEvent event)
    Deprecated.
    only the reactive version is supported
    void
    onDelete(org.hibernate.event.spi.DeleteEvent event, org.hibernate.event.spi.DeleteContext transientEntities)
    Deprecated.
    only the reactive version is supported
    protected void
    performDetachedEntityDeletionCheck(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.
    void
    wasJpaBootstrap(boolean wasJpaBootstrap)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefaultReactiveDeleteEventListener

      public DefaultReactiveDeleteEventListener()
  • Method Details

    • injectCallbackRegistry

      public void injectCallbackRegistry(org.hibernate.jpa.event.spi.CallbackRegistry callbackRegistry)
      Specified by:
      injectCallbackRegistry in interface org.hibernate.jpa.event.spi.CallbackRegistryConsumer
    • wasJpaBootstrap

      public void wasJpaBootstrap(boolean wasJpaBootstrap)
      Specified by:
      wasJpaBootstrap in interface org.hibernate.event.service.spi.JpaBootstrapSensitive
    • onDelete

      @Deprecated public void onDelete(org.hibernate.event.spi.DeleteEvent event)
      Deprecated.
      only the reactive version is supported
      Handle the given delete event.
      Specified by:
      onDelete in interface org.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:
      onDelete in interface org.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:
      reactiveOnDelete in interface ReactiveDeleteEventListener
      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:
      reactiveOnDelete in interface ReactiveDeleteEventListener
      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 event
      entity - The entity being delete processed
      persister - The entity persister
      transientEntities - 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 the ActionQueue for execution during flush.
      Parameters:
      session - The originating session
      entity - The entity to delete
      entityEntry - The entity's entry in the PersistenceContext
      isCascadeDeleteEnabled - 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