org.hibernate.engine

Class CascadeStyle

Implemented Interfaces:
Serializable
Known Direct Subclasses:
CascadeStyle.MultipleCascadeStyle

public abstract class CascadeStyle
extends java.lang.Object
implements Serializable

A contract for defining the aspects of cascading various persistence actions.
Author:
Gavin King
See Also:
CascadingAction

Nested Class Summary

static class
CascadeStyle.MultipleCascadeStyle

Field Summary

static CascadeStyle
ALL
save / delete / update / evict / lock / replicate / merge / persist
static CascadeStyle
ALL_DELETE_ORPHAN
save / delete / update / evict / lock / replicate / merge / persist + delete orphans
static CascadeStyle
DELETE
delete
static CascadeStyle
DELETE_ORPHAN
delete + delete orphans
static CascadeStyle
EVICT
evict
static CascadeStyle
LOCK
lock
static CascadeStyle
MERGE
merge
static CascadeStyle
NONE
no cascades
static CascadeStyle
PERSIST
create
static CascadeStyle
REFRESH
refresh
static CascadeStyle
REPLICATE
replicate
static CascadeStyle
UPDATE
save / update

Method Summary

abstract boolean
doCascade(CascadingAction action)
For this style, should the given action be cascaded?
static CascadeStyle
getCascadeStyle(String cascade)
Factory method for obtaining named cascade styles
boolean
hasOrphanDelete()
Do we need to delete orphaned collection elements?
boolean
reallyDoCascade(CascadingAction action)
Probably more aptly named something like doCascadeToCollectionElements(); it is however used from both the collection and to-one logic branches...

Field Details

ALL

public static final CascadeStyle ALL
save / delete / update / evict / lock / replicate / merge / persist

ALL_DELETE_ORPHAN

public static final CascadeStyle ALL_DELETE_ORPHAN
save / delete / update / evict / lock / replicate / merge / persist + delete orphans

DELETE

public static final CascadeStyle DELETE
delete

DELETE_ORPHAN

public static final CascadeStyle DELETE_ORPHAN
delete + delete orphans

EVICT

public static final CascadeStyle EVICT
evict

LOCK

public static final CascadeStyle LOCK
lock

MERGE

public static final CascadeStyle MERGE
merge

NONE

public static final CascadeStyle NONE
no cascades

PERSIST

public static final CascadeStyle PERSIST
create

REFRESH

public static final CascadeStyle REFRESH
refresh

REPLICATE

public static final CascadeStyle REPLICATE
replicate

UPDATE

public static final CascadeStyle UPDATE
save / update

Method Details

doCascade

public abstract boolean doCascade(CascadingAction action)
For this style, should the given action be cascaded?
Parameters:
action - The action to be checked for cascade-ability.
Returns:
True if the action should be cascaded under this style; false otherwise.

getCascadeStyle

public static CascadeStyle getCascadeStyle(String cascade)
Factory method for obtaining named cascade styles
Parameters:
cascade - The named cascade style name.
Returns:
The appropriate CascadeStyle

hasOrphanDelete

public boolean hasOrphanDelete()
Do we need to delete orphaned collection elements?
Returns:
True if this style need to account for orphan delete operations; false othwerwise.

reallyDoCascade

public boolean reallyDoCascade(CascadingAction action)
Probably more aptly named something like doCascadeToCollectionElements(); it is however used from both the collection and to-one logic branches...

For this style, should the given action really be cascaded? The default implementation is simply to return doCascade(CascadingAction); for certain styles (currently only delete-orphan), however, we need to be able to control this seperately.

Parameters:
action - The action to be checked for cascade-ability.
Returns:
True if the action should be really cascaded under this style; false otherwise.