org.hibernate.event.def
Class DefaultMergeEventListener

java.lang.Object
  extended by org.hibernate.event.def.AbstractReassociateEventListener
      extended by org.hibernate.event.def.AbstractSaveEventListener
          extended by org.hibernate.event.def.DefaultMergeEventListener
All Implemented Interfaces:
Serializable, MergeEventListener
Direct Known Subclasses:
DefaultSaveOrUpdateCopyEventListener, EJB3MergeEventListener

public class DefaultMergeEventListener
extends AbstractSaveEventListener
implements MergeEventListener

Defines the default copy event listener used by hibernate for copying entities in response to generated copy events.

Author:
Gavin King
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.hibernate.event.def.AbstractSaveEventListener
DELETED, DETACHED, PERSISTENT, TRANSIENT
 
Constructor Summary
DefaultMergeEventListener()
           
 
Method Summary
protected  void cascadeAfterSave(EventSource source, EntityPersister persister, Object entity, Object anything)
          Cascade behavior is redefined by this subclass, disable superclass behavior
protected  void cascadeBeforeSave(EventSource source, EntityPersister persister, Object entity, Object anything)
          Cascade behavior is redefined by this subclass, disable superclass behavior
protected  void cascadeOnMerge(EventSource source, EntityPersister persister, Object entity, Map copyCache)
          Perform any cascades needed as part of this copy event.
protected  void copyValues(EntityPersister persister, Object entity, Object target, SessionImplementor source, Map copyCache)
           
protected  void copyValues(EntityPersister persister, Object entity, Object target, SessionImplementor source, Map copyCache, ForeignKeyDirection foreignKeyDirection)
           
protected  void entityIsDetached(MergeEvent event, Map copyCache)
           
protected  void entityIsPersistent(MergeEvent event, Map copyCache)
           
protected  void entityIsTransient(MergeEvent event, Map copyCache)
           
protected  Boolean getAssumedUnsaved()
           
protected  CascadingAction getCascadeAction()
           
protected  Map getMergeMap(Object anything)
           
protected  org.hibernate.event.def.EventCache getTransientCopyCache(MergeEvent event, org.hibernate.event.def.EventCache copyCache)
           
protected  Object mergeTransientEntity(Object entity, String entityName, Serializable requestedId, EventSource source, Map copyCache)
           
 void onMerge(MergeEvent event)
          Handle the given merge event.
 void onMerge(MergeEvent event, Map copiedAlready)
          Handle the given merge event.
protected  void retryMergeTransientEntities(MergeEvent event, Map transientCopyCache, org.hibernate.event.def.EventCache copyCache, boolean isNullabilityChecked)
           
 
Methods inherited from class org.hibernate.event.def.AbstractSaveEventListener
getEntityState, getLoggableName, 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

DefaultMergeEventListener

public DefaultMergeEventListener()
Method Detail

getMergeMap

protected Map getMergeMap(Object anything)
Overrides:
getMergeMap in class AbstractSaveEventListener

onMerge

public void onMerge(MergeEvent event)
             throws HibernateException
Handle the given merge event.

Specified by:
onMerge in interface MergeEventListener
Parameters:
event - The merge event to be handled.
Throws:
HibernateException

getTransientCopyCache

protected org.hibernate.event.def.EventCache getTransientCopyCache(MergeEvent event,
                                                                   org.hibernate.event.def.EventCache copyCache)

retryMergeTransientEntities

protected void retryMergeTransientEntities(MergeEvent event,
                                           Map transientCopyCache,
                                           org.hibernate.event.def.EventCache copyCache,
                                           boolean isNullabilityChecked)

onMerge

public void onMerge(MergeEvent event,
                    Map copiedAlready)
             throws HibernateException
Handle the given merge event.

Specified by:
onMerge in interface MergeEventListener
Parameters:
event - The merge event to be handled.
Throws:
HibernateException

entityIsPersistent

protected void entityIsPersistent(MergeEvent event,
                                  Map copyCache)

entityIsTransient

protected void entityIsTransient(MergeEvent event,
                                 Map copyCache)

mergeTransientEntity

protected Object mergeTransientEntity(Object entity,
                                      String entityName,
                                      Serializable requestedId,
                                      EventSource source,
                                      Map copyCache)

entityIsDetached

protected void entityIsDetached(MergeEvent event,
                                Map copyCache)

copyValues

protected void copyValues(EntityPersister persister,
                          Object entity,
                          Object target,
                          SessionImplementor source,
                          Map copyCache)

copyValues

protected void copyValues(EntityPersister persister,
                          Object entity,
                          Object target,
                          SessionImplementor source,
                          Map copyCache,
                          ForeignKeyDirection foreignKeyDirection)

cascadeOnMerge

protected void cascadeOnMerge(EventSource source,
                              EntityPersister persister,
                              Object entity,
                              Map copyCache)
Perform any cascades needed as part of this copy event.

Parameters:
source - The merge event being processed.
persister - The persister of the entity being copied.
entity - The entity being copied.
copyCache - A cache of already copied instance.

getCascadeAction

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

getAssumedUnsaved

protected Boolean getAssumedUnsaved()
Overrides:
getAssumedUnsaved in class AbstractSaveEventListener

cascadeAfterSave

protected void cascadeAfterSave(EventSource source,
                                EntityPersister persister,
                                Object entity,
                                Object anything)
                         throws HibernateException
Cascade behavior is redefined by this subclass, disable superclass behavior

Overrides:
cascadeAfterSave in class AbstractSaveEventListener
Parameters:
source - The session from which the event originated.
persister - The entity's persister instance.
entity - The entity beng saved.
anything - Generally cascade-specific data
Throws:
HibernateException

cascadeBeforeSave

protected void cascadeBeforeSave(EventSource source,
                                 EntityPersister persister,
                                 Object entity,
                                 Object anything)
                          throws HibernateException
Cascade behavior is redefined by this subclass, disable superclass behavior

Overrides:
cascadeBeforeSave in class AbstractSaveEventListener
Parameters:
source - The session from whcih the save event originated.
persister - The entity's persister instance.
entity - The entity to be saved.
anything - Generally cascade-specific data
Throws:
HibernateException


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