org.hibernate.event.def
Class DefaultSaveOrUpdateEventListener

java.lang.Object
  extended byorg.hibernate.event.def.AbstractReassociateEventListener
      extended byorg.hibernate.event.def.AbstractSaveEventListener
          extended byorg.hibernate.event.def.DefaultSaveOrUpdateEventListener
All Implemented Interfaces:
SaveOrUpdateEventListener, Serializable
Direct Known Subclasses:
DefaultSaveEventListener, DefaultUpdateEventListener

public class DefaultSaveOrUpdateEventListener
extends AbstractSaveEventListener
implements SaveOrUpdateEventListener

Defines the default update event listener used by hibernate for updating transient entities in response to generated update events.

Author:
Steve Ebersole, Gavin King
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.hibernate.event.def.AbstractSaveEventListener
DELETED, DETACHED, PERSISTENT, TRANSIENT
 
Constructor Summary
DefaultSaveOrUpdateEventListener()
           
 
Method Summary
protected  void entityIsDetached(SaveOrUpdateEvent event)
          Handle the given update event.
protected  Serializable entityIsPersistent(SaveOrUpdateEvent event)
           
protected  Serializable entityIsTransient(SaveOrUpdateEvent event)
          Handle the given save event.
protected  CascadingAction getCascadeAction()
           
protected  Serializable getUpdateId(Object entity, EntityPersister persister, Serializable requestedId, EntityMode entityMode)
           
protected  boolean invokeUpdateLifecycle(Object entity, EntityPersister persister, EventSource source)
           
 void onSaveOrUpdate(SaveOrUpdateEvent event)
          Handle the given update event.
protected  Serializable performSaveOrUpdate(SaveOrUpdateEvent event)
           
protected  void performUpdate(SaveOrUpdateEvent event, Object entity, EntityPersister persister)
           
protected  boolean reassociateIfUninitializedProxy(Object object, SessionImplementor source)
           
protected  Serializable saveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)
          Save the transient instance, assigning the right identifier
 
Methods inherited from class org.hibernate.event.def.AbstractSaveEventListener
cascadeAfterSave, cascadeBeforeSave, getAssumedUnsaved, getEntityState, getLoggableName, getMergeMap, invokeSaveLifecycle, isVersionIncrementDisabled, performSave, performSaveOrReplicate, saveWithGeneratedId, saveWithRequestedId, substituteValuesIfNecessary, validate, visitCollectionsBeforeSave
 
Methods inherited from class org.hibernate.event.def.AbstractReassociateEventListener
reassociate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSaveOrUpdateEventListener

public DefaultSaveOrUpdateEventListener()
Method Detail

onSaveOrUpdate

public void onSaveOrUpdate(SaveOrUpdateEvent event)
                    throws HibernateException
Handle the given update event.

Specified by:
onSaveOrUpdate in interface SaveOrUpdateEventListener
Parameters:
event - The update event to be handled.
Throws:
HibernateException

reassociateIfUninitializedProxy

protected boolean reassociateIfUninitializedProxy(Object object,
                                                  SessionImplementor source)

performSaveOrUpdate

protected Serializable performSaveOrUpdate(SaveOrUpdateEvent event)

entityIsPersistent

protected Serializable entityIsPersistent(SaveOrUpdateEvent event)
                                   throws HibernateException
Throws:
HibernateException

entityIsTransient

protected Serializable entityIsTransient(SaveOrUpdateEvent event)
                                  throws HibernateException
Handle the given save event.

Parameters:
event - The save event to be handled.
Throws:
HibernateException

saveWithGeneratedOrRequestedId

protected Serializable saveWithGeneratedOrRequestedId(SaveOrUpdateEvent event)
Save the transient instance, assigning the right identifier


entityIsDetached

protected void entityIsDetached(SaveOrUpdateEvent event)
                         throws HibernateException
Handle the given update event.

Parameters:
event - The update event to be handled.
Throws:
HibernateException

getUpdateId

protected Serializable getUpdateId(Object entity,
                                   EntityPersister persister,
                                   Serializable requestedId,
                                   EntityMode entityMode)
                            throws HibernateException
Throws:
HibernateException

performUpdate

protected void performUpdate(SaveOrUpdateEvent event,
                             Object entity,
                             EntityPersister persister)
                      throws HibernateException
Throws:
HibernateException

invokeUpdateLifecycle

protected boolean invokeUpdateLifecycle(Object entity,
                                        EntityPersister persister,
                                        EventSource source)

getCascadeAction

protected CascadingAction getCascadeAction()
Specified by:
getCascadeAction in class AbstractSaveEventListener