类 AbstractSaveEventListener
- java.lang.Object
-
- org.hibernate.event.internal.AbstractReassociateEventListener
-
- org.hibernate.event.internal.AbstractSaveEventListener
-
- 所有已实现的接口:
Serializable,CallbackRegistryConsumer
- 直接已知子类:
DefaultMergeEventListener,DefaultPersistEventListener,DefaultReplicateEventListener,DefaultSaveOrUpdateEventListener
public abstract class AbstractSaveEventListener extends AbstractReassociateEventListener implements CallbackRegistryConsumer
A convenience base class for listeners responding to save events.- 作者:
- Steve Ebersole.
- 另请参阅:
- 序列化表格
-
-
构造器概要
构造器 构造器 说明 AbstractSaveEventListener()
-
方法概要
所有方法 实例方法 抽象方法 具体方法 修饰符和类型 方法 说明 protected voidcascadeAfterSave(EventSource source, EntityPersister persister, Object entity, Object anything)Handles to calls needed to perform post-save cascades.protected voidcascadeBeforeSave(EventSource source, EntityPersister persister, Object entity, Object anything)Handles the calls needed to perform pre-save cascades for the given entity.protected abstract CascadingActiongetCascadeAction()protected MapgetMergeMap(Object anything)voidinjectCallbackRegistry(CallbackRegistry callbackRegistry)Injection of the CallbackRegistryprotected booleaninvokeSaveLifecycle(Object entity, EntityPersister persister, EventSource source)protected booleanisVersionIncrementDisabled()After the save, will te version number be incremented if the instance is modified?protected SerializableperformSave(Object entity, Serializable id, EntityPersister persister, boolean useIdentityColumn, Object anything, EventSource source, boolean requiresImmediateIdAccess)Prepares the save call by checking the session caches for a pre-existing entity and performing any lifecycle callbacks.protected SerializableperformSaveOrReplicate(Object entity, EntityKey key, EntityPersister persister, boolean useIdentityColumn, Object anything, EventSource source, boolean requiresImmediateIdAccess)Performs all the actual work needed to save an entity (well to get the save moved to the execution queue).protected SerializablesaveWithGeneratedId(Object entity, String entityName, Object anything, EventSource source, boolean requiresImmediateIdAccess)Prepares the save call using a newly generated id.protected SerializablesaveWithRequestedId(Object entity, Serializable requestedId, String entityName, Object anything, EventSource source)Prepares the save call using the given requested id.protected booleansubstituteValuesIfNecessary(Object entity, Serializable id, Object[] values, EntityPersister persister, SessionImplementor source)Perform any property value substitution that is necessary (interceptor callback, version initialization...)protected booleanvisitCollectionsBeforeSave(Object entity, Serializable id, Object[] values, Type[] types, EventSource source)-
从类继承的方法 org.hibernate.event.internal.AbstractReassociateEventListener
reassociate
-
-
-
-
方法详细资料
-
injectCallbackRegistry
public void injectCallbackRegistry(CallbackRegistry callbackRegistry)
从接口复制的说明:CallbackRegistryConsumerInjection of the CallbackRegistry- 指定者:
injectCallbackRegistry在接口中CallbackRegistryConsumer- 参数:
callbackRegistry- The CallbackRegistry
-
saveWithRequestedId
protected Serializable saveWithRequestedId(Object entity, Serializable requestedId, String entityName, Object anything, EventSource source)
Prepares the save call using the given requested id.- 参数:
entity- The entity to be saved.requestedId- The id to which to associate the entity.entityName- The name of the entity being saved.anything- Generally cascade-specific information.source- The session which is the source of this save event.- 返回:
- The id used to save the entity.
-
saveWithGeneratedId
protected Serializable saveWithGeneratedId(Object entity, String entityName, Object anything, EventSource source, boolean requiresImmediateIdAccess)
Prepares the save call using a newly generated id.- 参数:
entity- The entity to be savedentityName- The entity-name for the entity to be savedanything- Generally cascade-specific information.source- The session which is the source of this save event.requiresImmediateIdAccess- does the event context require access to the identifier immediately after execution of this method (if not, post-insert style id generators may be postponed if we are outside a transaction).- 返回:
- The id used to save the entity; may be null depending on the type of id generator used and the requiresImmediateIdAccess value
-
performSave
protected Serializable performSave(Object entity, Serializable id, EntityPersister persister, boolean useIdentityColumn, Object anything, EventSource source, boolean requiresImmediateIdAccess)
Prepares the save call by checking the session caches for a pre-existing entity and performing any lifecycle callbacks.- 参数:
entity- The entity to be saved.id- The id by which to save the entity.persister- The entity's persister instance.useIdentityColumn- Is an identity column being used?anything- Generally cascade-specific information.source- The session from which the event originated.requiresImmediateIdAccess- does the event context require access to the identifier immediately after execution of this method (if not, post-insert style id generators may be postponed if we are outside a transaction).- 返回:
- The id used to save the entity; may be null depending on the type of id generator used and the requiresImmediateIdAccess value
-
invokeSaveLifecycle
protected boolean invokeSaveLifecycle(Object entity, EntityPersister persister, EventSource source)
-
performSaveOrReplicate
protected Serializable performSaveOrReplicate(Object entity, EntityKey key, EntityPersister persister, boolean useIdentityColumn, Object anything, EventSource source, boolean requiresImmediateIdAccess)
Performs all the actual work needed to save an entity (well to get the save moved to the execution queue).- 参数:
entity- The entity to be savedkey- The id to be used for saving the entity (or null, in the case of identity columns)persister- The entity's persister instance.useIdentityColumn- Should an identity column be used for id generation?anything- Generally cascade-specific information.source- The session which is the source of the current event.requiresImmediateIdAccess- Is access to the identifier required immediately after the completion of the save? persist(), for example, does not require this...- 返回:
- The id used to save the entity; may be null depending on the type of id generator used and the requiresImmediateIdAccess value
-
isVersionIncrementDisabled
protected boolean isVersionIncrementDisabled()
After the save, will te version number be incremented if the instance is modified?- 返回:
- True if the version will be incremented on an entity change after save; false otherwise.
-
visitCollectionsBeforeSave
protected boolean visitCollectionsBeforeSave(Object entity, Serializable id, Object[] values, Type[] types, EventSource source)
-
substituteValuesIfNecessary
protected boolean substituteValuesIfNecessary(Object entity, Serializable id, Object[] values, EntityPersister persister, SessionImplementor source)
Perform any property value substitution that is necessary (interceptor callback, version initialization...)- 参数:
entity- The entityid- The entity identifiervalues- The snapshot entity statepersister- The entity persistersource- The originating session- 返回:
- True if the snapshot state changed such that reinjection of the values into the entity is required.
-
cascadeBeforeSave
protected void cascadeBeforeSave(EventSource source, EntityPersister persister, Object entity, Object anything)
Handles the calls needed to perform pre-save cascades for the given entity.- 参数:
source- The session from which the save event originated.persister- The entity's persister instance.entity- The entity to be saved.anything- Generally cascade-specific data
-
cascadeAfterSave
protected void cascadeAfterSave(EventSource source, EntityPersister persister, Object entity, Object anything)
Handles to calls needed to perform post-save cascades.- 参数:
source- The session from which the event originated.persister- The entity's persister instance.entity- The entity being saved.anything- Generally cascade-specific data
-
getCascadeAction
protected abstract CascadingAction getCascadeAction()
-
-