Top Description Fields Constructors Methods
org.hibernate.engine

public final Class Cascade

extends Object
Class Inheritance
Imports
java.io.Serializable, java.util.Collection, .HashSet, .Iterator, .Stack, org.slf4j.Logger, .LoggerFactory, org.hibernate.EntityMode, .HibernateException, org.hibernate.collection.PersistentCollection, org.hibernate.event.EventSource, org.hibernate.persister.collection.CollectionPersister, org.hibernate.persister.entity.EntityPersister, org.hibernate.pretty.MessageHelper, org.hibernate.type.AssociationType, .CollectionType, .CompositeType, .EntityType, .Type, org.hibernate.util.CollectionHelper

Delegate responsible for, in conjunction with the various actions, implementing cascade processing.
Author
Gavin King
See Also
CascadingAction

Field Summary

Modifier and TypeField and Description
private CascadingAction
public static final int
AFTER_EVICT

A cascade point that occurs just after eviction of the parent entity from the session cache

public static final int
AFTER_INSERT_BEFORE_DELETE

A cascade point that occurs just after the insertion of the parent entity and just before deletion

public static final int
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

public static final int
AFTER_LOCK

A cascade point that occurs just after refreshing a parent entity

public static final int
AFTER_UPDATE

A cascade point that occurs just after update of the parent entity

public static final int
BEFORE_FLUSH

A cascade point that occurs just before the session is flushed

public static final int
BEFORE_INSERT_AFTER_DELETE

A cascade point that occurs just before the insertion of the parent entity and just after deletion

public static final int
BEFORE_MERGE

A cascade point that occurs just before merging from a transient parent entity into the object in the session cache

public static final int
BEFORE_REFRESH

A cascade point that occurs just after locking a transient parent entity into the session cache

private int
private Stack<E>
private EventSource
private static final Logger

Constructor Summary

AccessConstructor and Description
public
Cascade(final CascadingAction action, final int cascadeTo, final EventSource eventSource)

Method Summary

Modifier and TypeMethod and Description
public void
cascade(final EntityPersister
The parent's entity persister
persister
,
final Object
The parent reference.
parent
)

Cascade an action from the parent entity instance to all its children.

public void
cascade(final EntityPersister
The parent's entity persister
persister
,
final Object
The parent reference.
parent
,
final Object
Anything ;) Typically some form of cascade-local cache which is specific to each CascadingAction type
anything
)

Cascade an action from the parent entity instance to all its children.

private void
cascadeAssociation(final Object parent, final Object child, final Type type, final CascadeStyle style, final Object anything, final boolean isCascadeDeleteEnabled)

private boolean
private void
cascadeCollection(final Object parent, final Object child, final CascadeStyle style, final Object anything, final CollectionType type)

Cascade an action to a collection

private void
cascadeCollectionElements(final Object parent, final Object child, final CollectionType collectionType, final CascadeStyle style, final Type elemType, final Object anything, final boolean isCascadeDeleteEnabled)

Cascade to the collection elements

private void
cascadeComponent(final Object parent, final Object child, final CompositeType componentType, final String componentPropertyName, final Object anything)

private void
cascadeProperty(final Object parent, final Object child, final Type type, final CascadeStyle style, final String propertyName, final Object anything, final boolean isCascadeDeleteEnabled)

Cascade an action to the child or children

private void
cascadeToOne(final Object parent, final Object child, final Type type, final CascadeStyle style, final Object anything, final boolean isCascadeDeleteEnabled)

Cascade an action to a to-one association or any type

private String
private void
deleteOrphans(String entityName, PersistentCollection pc)

Delete any entities that were removed from the collection

private SessionFactoryImplementor
private boolean

Returns:

True if the attribute represents a logical one to one association
isLogicalOneToOne
(Type
The type representing the attribute metadata
type
)

Check if the association is a one to one in the logical model (either a shared-pk or unique fk).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

actionback to summary
private CascadingAction action
AFTER_EVICTback to summary
public static final int AFTER_EVICT

A cascade point that occurs just after eviction of the parent entity from the session cache

AFTER_INSERT_BEFORE_DELETEback to summary
public static final int AFTER_INSERT_BEFORE_DELETE

A cascade point that occurs just after the insertion of the parent entity and just before deletion

AFTER_INSERT_BEFORE_DELETE_VIA_COLLECTIONback to summary
public static final int 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

AFTER_LOCKback to summary
public static final int AFTER_LOCK

A cascade point that occurs just after refreshing a parent entity

AFTER_UPDATEback to summary
public static final int AFTER_UPDATE

A cascade point that occurs just after update of the parent entity

BEFORE_FLUSHback to summary
public static final int BEFORE_FLUSH

A cascade point that occurs just before the session is flushed

BEFORE_INSERT_AFTER_DELETEback to summary
public static final int BEFORE_INSERT_AFTER_DELETE

A cascade point that occurs just before the insertion of the parent entity and just after deletion

BEFORE_MERGEback to summary
public static final int BEFORE_MERGE

A cascade point that occurs just before merging from a transient parent entity into the object in the session cache

BEFORE_REFRESHback to summary
public static final int BEFORE_REFRESH

A cascade point that occurs just after locking a transient parent entity into the session cache

cascadeToback to summary
private int cascadeTo
componentPathStackback to summary
private Stack<E> componentPathStack
eventSourceback to summary
private EventSource eventSource
logback to summary
private static final Logger log

Constructor Detail

Cascadeback to summary
public Cascade(final CascadingAction action, final int cascadeTo, final EventSource eventSource)

Method Detail

cascadeback to summary
public void cascade(final EntityPersister persister, final Object parent) throws HibernateException

Cascade an action from the parent entity instance to all its children.

Parameters
persister:EntityPersister

The parent's entity persister

parent:Object

The parent reference.

cascadeback to summary
public void cascade(final EntityPersister persister, final Object parent, final Object anything) throws HibernateException

Cascade an action from the parent entity instance to all its children. This form is typicaly called from within cascade actions.

Parameters
persister:EntityPersister

The parent's entity persister

parent:Object

The parent reference.

anything:Object

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

cascadeAssociationback to summary
private void cascadeAssociation(final Object parent, final Object child, final Type type, final CascadeStyle style, final Object anything, final boolean isCascadeDeleteEnabled)
cascadeAssociationNowback to summary
private boolean cascadeAssociationNow(AssociationType associationType)
cascadeCollectionback to summary
private void cascadeCollection(final Object parent, final Object child, final CascadeStyle style, final Object anything, final CollectionType type)

Cascade an action to a collection

cascadeCollectionElementsback to summary
private void cascadeCollectionElements(final Object parent, final Object child, final CollectionType collectionType, final CascadeStyle style, final Type elemType, final Object anything, final boolean isCascadeDeleteEnabled) throws HibernateException

Cascade to the collection elements

cascadeComponentback to summary
private void cascadeComponent(final Object parent, final Object child, final CompositeType componentType, final String componentPropertyName, final Object anything)
cascadePropertyback to summary
private void cascadeProperty(final Object parent, final Object child, final Type type, final CascadeStyle style, final String propertyName, final Object anything, final boolean isCascadeDeleteEnabled) throws HibernateException

Cascade an action to the child or children

cascadeToOneback to summary
private void cascadeToOne(final Object parent, final Object child, final Type type, final CascadeStyle style, final Object anything, final boolean isCascadeDeleteEnabled)

Cascade an action to a to-one association or any type

composePropertyPathback to summary
private String composePropertyPath(String propertyName)
deleteOrphansback to summary
private void deleteOrphans(String entityName, PersistentCollection pc) throws HibernateException

Delete any entities that were removed from the collection

getFactoryback to summary
private SessionFactoryImplementor getFactory()
isLogicalOneToOneback to summary
private boolean isLogicalOneToOne(Type type)

Check if the association is a one to one in the logical model (either a shared-pk or unique fk).

Parameters
type:Type

The type representing the attribute metadata

Returns:boolean

True if the attribute represents a logical one to one association