类 DefaultDeleteEventListener
- java.lang.Object
-
- org.hibernate.event.internal.DefaultDeleteEventListener
-
public class DefaultDeleteEventListener extends Object implements DeleteEventListener, CallbackRegistryConsumer, JpaBootstrapSensitive
Defines the default delete event listener used by hibernate for deleting entities from the datastore in response to generated delete events.- 作者:
- Steve Ebersole
- 另请参阅:
- 序列化表格
-
-
构造器概要
构造器 构造器 说明 DefaultDeleteEventListener()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected voidcascadeAfterDelete(EventSource session, EntityPersister persister, Object entity, Set transientEntities)protected voidcascadeBeforeDelete(EventSource session, EntityPersister persister, Object entity, EntityEntry entityEntry, Set transientEntities)protected voiddeleteEntity(EventSource session, Object entity, EntityEntry entityEntry, boolean isCascadeDeleteEnabled, boolean isOrphanRemovalBeforeUpdates, EntityPersister persister, Set transientEntities)Perform the entity deletion.protected voiddeleteTransientEntity(EventSource session, Object entity, boolean cascadeDeleteEnabled, EntityPersister persister, Set transientEntities)We encountered a delete request on a transient instance.voidinjectCallbackRegistry(CallbackRegistry callbackRegistry)Injection of the CallbackRegistryprotected booleaninvokeDeleteLifecycle(EventSource session, Object entity, EntityPersister persister)voidonDelete(DeleteEvent event)Handle the given delete event.voidonDelete(DeleteEvent event, Set transientEntities)Handle the given delete event.protected voidperformDetachedEntityDeletionCheck(DeleteEvent event)Called when we have recognized an attempt to delete a detached entity.voidwasJpaBootstrap(boolean wasJpaBootstrap)
-
-
-
方法详细资料
-
injectCallbackRegistry
public void injectCallbackRegistry(CallbackRegistry callbackRegistry)
从接口复制的说明:CallbackRegistryConsumerInjection of the CallbackRegistry- 指定者:
injectCallbackRegistry在接口中CallbackRegistryConsumer- 参数:
callbackRegistry- The CallbackRegistry
-
wasJpaBootstrap
public void wasJpaBootstrap(boolean wasJpaBootstrap)
- 指定者:
wasJpaBootstrap在接口中JpaBootstrapSensitive
-
onDelete
public void onDelete(DeleteEvent event) throws HibernateException
Handle the given delete event.- 指定者:
onDelete在接口中DeleteEventListener- 参数:
event- The delete event to be handled.- 抛出:
HibernateException
-
onDelete
public void onDelete(DeleteEvent event, Set transientEntities) throws HibernateException
Handle the given delete event. This is the cascaded form.- 指定者:
onDelete在接口中DeleteEventListener- 参数:
event- The delete event.transientEntities- The cache of entities already deleted- 抛出:
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.- 参数:
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.- 参数:
session- The session which is the source of the evententity- The entity being delete processedcascadeDeleteEnabled- Is cascading of deletes enabledpersister- The entity persistertransientEntities- A cache of already visited transient entities (to avoid infinite recursion).
-
deleteEntity
protected final void deleteEntity(EventSource session, Object entity, EntityEntry entityEntry, boolean isCascadeDeleteEnabled, boolean isOrphanRemovalBeforeUpdates, EntityPersister persister, Set 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.- 参数:
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.
-
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
-
cascadeAfterDelete
protected void cascadeAfterDelete(EventSource session, EntityPersister persister, Object entity, Set transientEntities) throws HibernateException
-
-