## org.hibernate.event.internal
Class DefaultDeleteEventListener

    java.lang.Object
      org.hibernate.event.internal.DefaultDeleteEventListener

All Implemented Interfaces:
  Serializable, DeleteEventListener

Direct Known Subclasses:
  EJB3DeleteEventListener

    public class DefaultDeleteEventListener

extends Object
implements DeleteEventListener

Defines the default delete event listener used by hibernate for deleting entities from the datastore in response to generated delete events.

See Also:
  Serialized Form

Constructor Summary
`DefaultDeleteEventListener()`

Method Summary
`protected void` `cascadeAfterDelete(EventSource session, EntityPersister persister, Object entity, Set transientEntities)`
`protected void` `cascadeBeforeDelete(EventSource session, EntityPersister persister, Object entity, EntityEntry entityEntry, Set transientEntities)`
`protected void` `deleteEntity(EventSource session, Object entity, EntityEntry entityEntry, boolean isCascadeDeleteEnabled, EntityPersister persister, Set transientEntities)` Perform the entity deletion.
`protected void` `deleteTransientEntity(EventSource session, Object entity, boolean cascadeDeleteEnabled, EntityPersister persister, Set transientEntities)` We encountered a delete request on a transient instance.
`protected boolean` `invokeDeleteLifecycle(EventSource session, Object entity, EntityPersister persister)`
`void` `onDelete(DeleteEvent event)` Handle the given delete event.
`void` `onDelete(DeleteEvent event, Set transientEntities)` Handle the given delete event.
`protected void` `performDetachedEntityDeletionCheck(DeleteEvent event)` Called when we have recognized an attempt to delete a detached entity.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultDeleteEventListener

    public DefaultDeleteEventListener()

Method Detail

### onDelete

    public void onDelete(DeleteEvent event)
                  throws HibernateException

  Handle the given delete event.

  Specified by:
    `onDelete` in interface `DeleteEventListener`
  Parameters:
    `event` - The delete event to be handled.
  Throws:
    `HibernateException`

### onDelete

    public void onDelete(DeleteEvent event,
                         Set transientEntities)
                  throws HibernateException

  Handle the given delete event. This is the cascaded form.

  Specified by:
    `onDelete` in interface `DeleteEventListener`
  Parameters:
    `event` - The delete event.
    `transientEntities` - The cache of entities already deleted
  Throws:
    `HibernateException`

### performDetachedEntityDeletionCheck

    protected void performDetachedEntityDeletionCheck(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 void deleteTransientEntity(EventSource session,
                                         Object entity,
                                         boolean cascadeDeleteEnabled,
                                         EntityPersister persister,
                                         Set 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
    `cascadeDeleteEnabled` - Is cascading of deletes enabled
    `persister` - The entity persister
    `transientEntities` - A cache of already visited transient entities (to avoid infinite recursion).

### deleteEntity

    protected final void deleteEntity(EventSource session,
                                      Object entity,
                                      EntityEntry entityEntry,
                                      boolean isCascadeDeleteEnabled,
                                      EntityPersister persister,
                                      Set 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.

### invokeDeleteLifecycle

    protected boolean invokeDeleteLifecycle(EventSource session,
                                            Object entity,
                                            EntityPersister persister)

### cascadeBeforeDelete

    protected void cascadeBeforeDelete(EventSource session,
                                       EntityPersister persister,
                                       Object entity,
                                       EntityEntry entityEntry,
                                       Set transientEntities)
                                throws HibernateException

  Throws:
    `HibernateException`

### cascadeAfterDelete

    protected void cascadeAfterDelete(EventSource session,
                                      EntityPersister persister,
                                      Object entity,
                                      Set transientEntities)
                               throws HibernateException

  Throws:
    `HibernateException`

Copyright © 2001-2012 Red Hat, Inc. All Rights Reserved.