org.hibernate.event.internal
Class DefaultSaveOrUpdateEventListener

java.lang.Object
  extended by org.hibernate.event.internal.AbstractReassociateEventListener
      extended by org.hibernate.event.internal.AbstractSaveEventListener
          extended by org.hibernate.event.internal.DefaultSaveOrUpdateEventListener
All Implemented Interfaces:
Serializable, SaveOrUpdateEventListener
Direct Known Subclasses:
DefaultSaveEventListener, DefaultUpdateEventListener, EJB3SaveOrUpdateEventListener

public class DefaultSaveOrUpdateEventListener
extends AbstractSaveEventListener
implements SaveOrUpdateEventListener

Defines the default listener used by Hibernate for handling save-update events.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.hibernate.event.internal.AbstractSaveEventListener
AbstractSaveEventListener.EntityState
 
Constructor Summary
DefaultSaveOrUpdateEventListener()
           
 
Method Summary
protected  void entityIsDetached(SaveOrUpdateEvent event)
          The given save-update event named a detached entity.
protected  Serializable entityIsPersistent(SaveOrUpdateEvent event)
           
protected  Serializable entityIsTransient(SaveOrUpdateEvent event)
          The given save-update event named a transient entity.
protected  CascadingAction getCascadeAction()
           
protected  Serializable getUpdateId(Object entity, EntityPersister persister, Serializable requestedId, SessionImplementor session)
          Determine the id to use for updating.
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.internal.AbstractSaveEventListener
cascadeAfterSave, cascadeBeforeSave, getAssumedUnsaved, getEntityState, getLoggableName, getMergeMap, invokeSaveLifecycle, isVersionIncrementDisabled, performSave, performSaveOrReplicate, saveWithGeneratedId, saveWithRequestedId, substituteValuesIfNecessary, visitCollectionsBeforeSave
 
Methods inherited from class org.hibernate.event.internal.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)
Handle the given update event.

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

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)
The given save-update event named a transient entity.

Here, we will perform the save processing.

Parameters:
event - The save event to be handled.
Returns:
The entity's identifier after saving.

saveWithGeneratedOrRequestedId

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

Parameters:
event - The initiating event.
Returns:
The entity's identifier value after saving.

entityIsDetached

protected void entityIsDetached(SaveOrUpdateEvent event)
The given save-update event named a detached entity.

Here, we will perform the update processing.

Parameters:
event - The update event to be handled.

getUpdateId

protected Serializable getUpdateId(Object entity,
                                   EntityPersister persister,
                                   Serializable requestedId,
                                   SessionImplementor session)
Determine the id to use for updating.

Parameters:
entity - The entity.
persister - The entity persister
requestedId - The requested identifier
session - The session
Returns:
The id.
Throws:
TransientObjectException - If the entity is considered transient.

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


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