Top Description Fields Constructors Methods
org.hibernate.engine

public abstract Class CascadingAction

extends Object
Class Inheritance
Imports
java.util.Iterator, .Map, .Set, org.slf4j.Logger, .LoggerFactory, org.hibernate.HibernateException, .LockMode, .ReplicationMode, .TransientObjectException, .LockOptions, org.hibernate.proxy.HibernateProxy, org.hibernate.persister.entity.EntityPersister, org.hibernate.collection.PersistentCollection, org.hibernate.event.EventSource, org.hibernate.type.CollectionType, .Type, .EntityType

A session action that may be cascaded from parent entity to its children
Author
Gavin King

Field Summary

Modifier and TypeField and Description
public static final CascadingAction
public static final CascadingAction
public static final CascadingAction
private static final Logger
public static final CascadingAction
public static final CascadingAction
public static final CascadingAction
PERSIST_ON_FLUSH

Execute persist during flush time

public static final CascadingAction
public static final CascadingAction
public static final CascadingAction
public static final CascadingAction

Constructor Summary

AccessConstructor and Description
pack-priv
CascadingAction()

protected constructor

Method Summary

Modifier and TypeMethod and Description
public abstract void
cascade(EventSource
The session within which the cascade is occuring.
session
,
Object
The child to which cascading should be performed.
child
,
String
The child's entity name
entityName
,
Object
Anything ;) Typically some form of cascade-local cache which is specific to each CascadingAction type
anything
,
boolean
Are cascading deletes enabled.
isCascadeDeleteEnabled
)

Cascade the action to the child object.

private static boolean
public abstract boolean

Returns:

True if this action can lead to deletions of orphans.
deleteOrphans
()

Does this action potentially extrapolate to orphan deletes?

private static Iterator<E>

Returns:

The children iterator.
getAllElementsIterator
(EventSource
The session within which the cascade is occuring.
session
,
CollectionType
The mapping type of the collection.
collectionType
,
Object
The collection instance.
collection
)

Given a collection, get an iterator of all its children, loading them from the database if necessary.

public abstract Iterator<E>

Returns:

The children iterator.
getCascadableChildrenIterator
(EventSource
The session within which the cascade is occuring.
session
,
CollectionType
The mapping type of the collection.
collectionType
,
Object
The collection instance.
collection
)

Given a collection, get an iterator of the children upon which the current cascading action should be visited.

public static Iterator<E>
getLoadedElementsIterator(SessionImplementor session, CollectionType collectionType, Object collection)

Iterate just the elements of the collection that are already there.

public void
noCascade(EventSource
The session witin which the cascade is occurring.
session
,
Object
The property value
child
,
Object
The property value owner
parent
,
EntityPersister
The entity persister for the owner
persister
,
int
The index of the property within the owner.
propertyIndex
)

Called (in the case of requiresNoCascadeChecking returning true) to validate that no cascade on the given property is considered a valid semantic.

public boolean
performOnLazyProperty()

Should this action be performed (or noCascade consulted) in the case of lazy properties.

public boolean

Returns:

True if this action requires no-cascade verification; false otherwise.
requiresNoCascadeChecking
()

Does the specified cascading action require verification of no cascade validity?

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

DELETEback to summary
public static final CascadingAction DELETE
See Also
org.hibernate.Session#delete(Object)
EVICTback to summary
public static final CascadingAction EVICT
See Also
org.hibernate.Session#evict(Object)
LOCKback to summary
public static final CascadingAction LOCK
See Also
org.hibernate.Session#lock(Object, LockMode)
logback to summary
private static final Logger log
MERGEback to summary
public static final CascadingAction MERGE
See Also
org.hibernate.Session#merge(Object)
PERSISTback to summary
public static final CascadingAction PERSIST
See Also
org.hibernate.Session#persist(Object)
PERSIST_ON_FLUSHback to summary
public static final CascadingAction PERSIST_ON_FLUSH

Execute persist during flush time

See Also
org.hibernate.Session#persist(Object)
REFRESHback to summary
public static final CascadingAction REFRESH
See Also
org.hibernate.Session#refresh(Object)
REPLICATEback to summary
public static final CascadingAction REPLICATE
See Also
org.hibernate.Session#replicate(Object, org.hibernate.ReplicationMode)
SAVE_UPDATEback to summary
public static final CascadingAction SAVE_UPDATE
See Also
org.hibernate.Session#saveOrUpdate(Object)
SAVE_UPDATE_COPYback to summary
public static final CascadingAction SAVE_UPDATE_COPY
See Also
org.hibernate.classic.Session#saveOrUpdateCopy(Object)

Constructor Detail

CascadingActionback to summary
pack-priv CascadingAction()

protected constructor

Method Detail

cascadeback to summary
public abstract void cascade(EventSource session, Object child, String entityName, Object anything, boolean isCascadeDeleteEnabled) throws HibernateException

Cascade the action to the child object.

Parameters
session:EventSource

The session within which the cascade is occuring.

child:Object

The child to which cascading should be performed.

entityName:String

The child's entity name

anything:Object

Anything ;) Typically some form of cascade-local cache which is specific to each CascadingAction type

isCascadeDeleteEnabled:boolean

Are cascading deletes enabled.

collectionIsInitializedback to summary
private static boolean collectionIsInitialized(Object collection)
deleteOrphansback to summary
public abstract boolean deleteOrphans()

Does this action potentially extrapolate to orphan deletes?

Returns:boolean

True if this action can lead to deletions of orphans.

getAllElementsIteratorback to summary
private static Iterator<E> getAllElementsIterator(EventSource session, CollectionType collectionType, Object collection)

Given a collection, get an iterator of all its children, loading them from the database if necessary.

Parameters
session:EventSource

The session within which the cascade is occuring.

collectionType:CollectionType

The mapping type of the collection.

collection:Object

The collection instance.

Returns:Iterator<E>

The children iterator.

getCascadableChildrenIteratorback to summary
public abstract Iterator<E> getCascadableChildrenIterator(EventSource session, CollectionType collectionType, Object collection)

Given a collection, get an iterator of the children upon which the current cascading action should be visited.

Parameters
session:EventSource

The session within which the cascade is occuring.

collectionType:CollectionType

The mapping type of the collection.

collection:Object

The collection instance.

Returns:Iterator<E>

The children iterator.

getLoadedElementsIteratorback to summary
public static Iterator<E> 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.

noCascadeback to summary
public void noCascade(EventSource session, Object child, Object parent, EntityPersister persister, int propertyIndex)

Called (in the case of requiresNoCascadeChecking returning true) to validate that no cascade on the given property is considered a valid semantic.

Parameters
session:EventSource

The session witin which the cascade is occurring.

child:Object

The property value

parent:Object

The property value owner

persister:EntityPersister

The entity persister for the owner

propertyIndex:int

The index of the property within the owner.

performOnLazyPropertyback to summary
public boolean performOnLazyProperty()

Should this action be performed (or noCascade consulted) in the case of lazy properties.

requiresNoCascadeCheckingback to summary
public boolean requiresNoCascadeChecking()

Does the specified cascading action require verification of no cascade validity?

Returns:boolean

True if this action requires no-cascade verification; false otherwise.