org.hibernate.engine
Class Cascades

java.lang.Object
  extended byorg.hibernate.engine.Cascades

public final class Cascades
extends Object

Implements cascaded save / delete / update / lock / evict / replicate / persist / merge

Author:
Gavin King
See Also:
AssociationType

Nested Class Summary
static class Cascades.CascadeStyle
          A style of cascade that can be specified by the mapping for an association.
static class Cascades.CascadingAction
          A session action that may be cascaded from parent entity to its children
static class Cascades.IdentifierValue
          A strategy for determining if an identifier value is an identifier of a new transient instance or a previously persistent transient instance.
static class Cascades.MultipleCascadeStyle
           
static class Cascades.VersionValue
          A strategy for determining if a version value is an version of a new transient instance or a previously persistent transient instance.
 
Field Summary
static Cascades.CascadingAction ACTION_DELETE
           
static Cascades.CascadingAction ACTION_EVICT
           
static Cascades.CascadingAction ACTION_LOCK
           
static Cascades.CascadingAction ACTION_MERGE
           
static Cascades.CascadingAction ACTION_PERSIST
           
static Cascades.CascadingAction ACTION_REFRESH
           
static Cascades.CascadingAction ACTION_REPLICATE
           
static Cascades.CascadingAction ACTION_SAVE_UPDATE
           
static Cascades.CascadingAction ACTION_SAVE_UPDATE_COPY
           
static int CASCADE_AFTER_EVICT
          A cascade point that occurs just after eviction of the parent entity from the session cache
static int CASCADE_AFTER_INSERT_BEFORE_DELETE
          A cascade point that occurs just after the insertion of the parent entity and just before deletion
static int CASCADE_AFTER_INSERT_BEFORE_DELETE_VIA_COLLECTION
          A cascade point that occurs just after the insertion of the parent entity and just before deletion, inside a collection
static int CASCADE_AFTER_LOCK
          A cascade point that occurs just after refreshing a parent entity
static int CASCADE_AFTER_REFRESH
          A cascade point that occurs just after locking a transient parent entity into the session cache
static int CASCADE_AFTER_UPDATE
          A cascade point that occurs just after update of the parent entity
static int CASCADE_BEFORE_FLUSH
          A cascade point that occurs just before the session is flushed
static int CASCADE_BEFORE_INSERT_AFTER_DELETE
          A cascade point that occurs just before the insertion of the parent entity and just after deletion
static int CASCADE_BEFORE_MERGE
          A cascade point that occurs just before merging from a transient parent entity into the object in the session cache
static Cascades.IdentifierValue SAVE_ANY
          Always assume the transient instance is newly instantiated
static Cascades.IdentifierValue SAVE_NONE
          Never assume the transient instance is newly instantiated
static Cascades.IdentifierValue SAVE_NULL
          Assume the transient instance is newly instantiated if the identifier is null.
static Cascades.CascadeStyle STYLE_ALL
          save / delete / update / evict / lock / replicate / merge / persist
static Cascades.CascadeStyle STYLE_ALL_DELETE_ORPHAN
          save / delete / update / evict / lock / replicate / merge / persist + delete orphans
static Cascades.CascadeStyle STYLE_DELETE
          delete
static Cascades.CascadeStyle STYLE_DELETE_ORPHAN
          delete + delete orphans
static Cascades.CascadeStyle STYLE_EVICT
          evict
static Cascades.CascadeStyle STYLE_LOCK
          lock
static Cascades.CascadeStyle STYLE_MERGE
          merge
static Cascades.CascadeStyle STYLE_NONE
          no cascades
static Cascades.CascadeStyle STYLE_PERSIST
          create
static Cascades.CascadeStyle STYLE_REFRESH
          refresh
static Cascades.CascadeStyle STYLE_REPLICATE
          replicate
static Cascades.CascadeStyle STYLE_SAVE_UPDATE
          save / update
static Cascades.IdentifierValue UNDEFINED
           
static Cascades.VersionValue VERSION_NEGATIVE
          Assume the transient instance is newly instantiated if the version is negative, otherwise assume it is a detached instance.
static Cascades.VersionValue VERSION_SAVE_NULL
          Assume the transient instance is newly instantiated if the version is null, otherwise assume it is a detached instance.
static Cascades.VersionValue VERSION_UNDEFINED
          Assume the transient instance is newly instantiated if the version is null, otherwise defer to the identifier unsaved-value.
 
Method Summary
static void cascade(SessionImplementor session, EntityPersister persister, Object parent, Cascades.CascadingAction action, int cascadeTo)
          Cascade an action from the parent object to all its children
static void cascade(SessionImplementor session, EntityPersister persister, Object parent, Cascades.CascadingAction action, int cascadeTo, Object anything)
          Cascade an action from the parent object to all its children
static Cascades.CascadeStyle getCascadeStyle(String cascade)
           
static Iterator getLoadedElementsIterator(SessionImplementor session, CollectionType collectionType, Object collection)
          Iterate just the elements of the collection that are already there.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACTION_DELETE

public static final Cascades.CascadingAction ACTION_DELETE
See Also:
Session.delete(Object)

ACTION_LOCK

public static final Cascades.CascadingAction ACTION_LOCK
See Also:
Session.lock(Object, LockMode)

ACTION_REFRESH

public static final Cascades.CascadingAction ACTION_REFRESH
See Also:
Session.refresh(Object)

ACTION_EVICT

public static final Cascades.CascadingAction ACTION_EVICT
See Also:
Session.evict(Object)

ACTION_SAVE_UPDATE

public static final Cascades.CascadingAction ACTION_SAVE_UPDATE
See Also:
Session.saveOrUpdate(Object)

ACTION_MERGE

public static final Cascades.CascadingAction ACTION_MERGE
See Also:
Session.merge(Object)

ACTION_SAVE_UPDATE_COPY

public static final Cascades.CascadingAction ACTION_SAVE_UPDATE_COPY
See Also:
Session.saveOrUpdateCopy(Object)

ACTION_PERSIST

public static final Cascades.CascadingAction ACTION_PERSIST
See Also:
Session.persist(Object)

ACTION_REPLICATE

public static final Cascades.CascadingAction ACTION_REPLICATE

CASCADE_AFTER_INSERT_BEFORE_DELETE

public static final int CASCADE_AFTER_INSERT_BEFORE_DELETE
A cascade point that occurs just after the insertion of the parent entity and just before deletion

See Also:
Constant Field Values

CASCADE_BEFORE_INSERT_AFTER_DELETE

public static final int CASCADE_BEFORE_INSERT_AFTER_DELETE
A cascade point that occurs just before the insertion of the parent entity and just after deletion

See Also:
Constant Field Values

CASCADE_AFTER_INSERT_BEFORE_DELETE_VIA_COLLECTION

public static final int CASCADE_AFTER_INSERT_BEFORE_DELETE_VIA_COLLECTION
A cascade point that occurs just after the insertion of the parent entity and just before deletion, inside a collection

See Also:
Constant Field Values

CASCADE_AFTER_UPDATE

public static final int CASCADE_AFTER_UPDATE
A cascade point that occurs just after update of the parent entity

See Also:
Constant Field Values

CASCADE_BEFORE_FLUSH

public static final int CASCADE_BEFORE_FLUSH
A cascade point that occurs just before the session is flushed

See Also:
Constant Field Values

CASCADE_AFTER_EVICT

public static final int CASCADE_AFTER_EVICT
A cascade point that occurs just after eviction of the parent entity from the session cache

See Also:
Constant Field Values

CASCADE_AFTER_REFRESH

public static final int CASCADE_AFTER_REFRESH
A cascade point that occurs just after locking a transient parent entity into the session cache

See Also:
Constant Field Values

CASCADE_AFTER_LOCK

public static final int CASCADE_AFTER_LOCK
A cascade point that occurs just after refreshing a parent entity

See Also:
Constant Field Values

CASCADE_BEFORE_MERGE

public static final int CASCADE_BEFORE_MERGE
A cascade point that occurs just before merging from a transient parent entity into the object in the session cache

See Also:
Constant Field Values

STYLE_ALL_DELETE_ORPHAN

public static final Cascades.CascadeStyle STYLE_ALL_DELETE_ORPHAN
save / delete / update / evict / lock / replicate / merge / persist + delete orphans


STYLE_ALL

public static final Cascades.CascadeStyle STYLE_ALL
save / delete / update / evict / lock / replicate / merge / persist


STYLE_SAVE_UPDATE

public static final Cascades.CascadeStyle STYLE_SAVE_UPDATE
save / update


STYLE_LOCK

public static final Cascades.CascadeStyle STYLE_LOCK
lock


STYLE_REFRESH

public static final Cascades.CascadeStyle STYLE_REFRESH
refresh


STYLE_EVICT

public static final Cascades.CascadeStyle STYLE_EVICT
evict


STYLE_REPLICATE

public static final Cascades.CascadeStyle STYLE_REPLICATE
replicate


STYLE_MERGE

public static final Cascades.CascadeStyle STYLE_MERGE
merge


STYLE_PERSIST

public static final Cascades.CascadeStyle STYLE_PERSIST
create


STYLE_DELETE

public static final Cascades.CascadeStyle STYLE_DELETE
delete


STYLE_DELETE_ORPHAN

public static final Cascades.CascadeStyle STYLE_DELETE_ORPHAN
delete + delete orphans


STYLE_NONE

public static final Cascades.CascadeStyle STYLE_NONE
no cascades


SAVE_ANY

public static final Cascades.IdentifierValue SAVE_ANY
Always assume the transient instance is newly instantiated


SAVE_NONE

public static final Cascades.IdentifierValue SAVE_NONE
Never assume the transient instance is newly instantiated


SAVE_NULL

public static final Cascades.IdentifierValue SAVE_NULL
Assume the transient instance is newly instantiated if the identifier is null.


UNDEFINED

public static final Cascades.IdentifierValue UNDEFINED

VERSION_SAVE_NULL

public static final Cascades.VersionValue VERSION_SAVE_NULL
Assume the transient instance is newly instantiated if the version is null, otherwise assume it is a detached instance.


VERSION_UNDEFINED

public static final Cascades.VersionValue VERSION_UNDEFINED
Assume the transient instance is newly instantiated if the version is null, otherwise defer to the identifier unsaved-value.


VERSION_NEGATIVE

public static final Cascades.VersionValue VERSION_NEGATIVE
Assume the transient instance is newly instantiated if the version is negative, otherwise assume it is a detached instance.

Method Detail

cascade

public static void cascade(SessionImplementor session,
                           EntityPersister persister,
                           Object parent,
                           Cascades.CascadingAction action,
                           int cascadeTo)
                    throws HibernateException
Cascade an action from the parent object to all its children

Throws:
HibernateException

cascade

public static void cascade(SessionImplementor session,
                           EntityPersister persister,
                           Object parent,
                           Cascades.CascadingAction action,
                           int cascadeTo,
                           Object anything)
                    throws HibernateException
Cascade an action from the parent object to all its children

Throws:
HibernateException

getLoadedElementsIterator

public static Iterator getLoadedElementsIterator(SessionImplementor session,
                                                 CollectionType collectionType,
                                                 Object collection)
Iterate just the elements of the collection that are already there. Don't load any new elements from the database.


getCascadeStyle

public static Cascades.CascadeStyle getCascadeStyle(String cascade)