Top Description Inners Fields Constructors Methods
org.hibernate.engine

public abstract Class CascadeStyle

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable
Known Direct Subclasses
org.hibernate.engine.CascadeStyle.MultipleCascadeStyle
Imports
java.io.Serializable, java.util.HashMap, .Map, org.hibernate.MappingException, org.hibernate.util.ArrayHelper

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

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class

Field Summary

Modifier and TypeField and Description
public static final CascadeStyle
ALL

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

public static final CascadeStyle
ALL_DELETE_ORPHAN

save / delete / update / evict / lock / replicate / merge / persist + delete orphans

public static final CascadeStyle
DELETE

delete

public static final CascadeStyle
DELETE_ORPHAN

delete + delete orphans

public static final CascadeStyle
EVICT

evict

public static final CascadeStyle
LOCK

lock

public static final CascadeStyle
MERGE

merge

public static final CascadeStyle
NONE

no cascades

public static final CascadeStyle
PERSIST

create

public static final CascadeStyle
REFRESH

refresh

public static final CascadeStyle
REPLICATE

replicate

pack-priv static final Map<K, V>
public static final CascadeStyle
UPDATE

save / update

Constructor Summary

AccessConstructor and Description
pack-priv
CascadeStyle()

package-protected constructor

Method Summary

Modifier and TypeMethod and Description
public abstract boolean

Returns:

True if the action should be cascaded under this style; false otherwise.
doCascade
(CascadingAction
The action to be checked for cascade-ability.
action
)

For this style, should the given action be cascaded?

public static CascadeStyle

Returns:

The appropriate CascadeStyle
getCascadeStyle
(String
The named cascade style name.
cascade
)

Factory method for obtaining named cascade styles

public boolean

Returns:

True if this style need to account for orphan delete operations; false othwerwise.
hasOrphanDelete
()

Do we need to delete orphaned collection elements?

public boolean

Returns:

True if the action should be really cascaded under this style; false otherwise.
reallyDoCascade
(CascadingAction
The action to be checked for cascade-ability.
action
)

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

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALLback to summary
public static final CascadeStyle ALL

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

ALL_DELETE_ORPHANback to summary
public static final CascadeStyle ALL_DELETE_ORPHAN

save / delete / update / evict / lock / replicate / merge / persist + delete orphans

DELETEback to summary
public static final CascadeStyle DELETE

delete

DELETE_ORPHANback to summary
public static final CascadeStyle DELETE_ORPHAN

delete + delete orphans

EVICTback to summary
public static final CascadeStyle EVICT

evict

LOCKback to summary
public static final CascadeStyle LOCK

lock

MERGEback to summary
public static final CascadeStyle MERGE

merge

NONEback to summary
public static final CascadeStyle NONE

no cascades

PERSISTback to summary
public static final CascadeStyle PERSIST

create

REFRESHback to summary
public static final CascadeStyle REFRESH

refresh

REPLICATEback to summary
public static final CascadeStyle REPLICATE

replicate

STYLESback to summary
pack-priv static final Map<K, V> STYLES
UPDATEback to summary
public static final CascadeStyle UPDATE

save / update

Constructor Detail

CascadeStyleback to summary
pack-priv CascadeStyle()

package-protected constructor

Method Detail

doCascadeback to summary
public abstract boolean doCascade(CascadingAction action)

For this style, should the given action be cascaded?

Parameters
action:CascadingAction

The action to be checked for cascade-ability.

Returns:boolean

True if the action should be cascaded under this style; false otherwise.

getCascadeStyleback to summary
public static CascadeStyle getCascadeStyle(String cascade)

Factory method for obtaining named cascade styles

Parameters
cascade:String

The named cascade style name.

Returns:CascadeStyle

The appropriate CascadeStyle

hasOrphanDeleteback to summary
public boolean hasOrphanDelete()

Do we need to delete orphaned collection elements?

Returns:boolean

True if this style need to account for orphan delete operations; false othwerwise.

reallyDoCascadeback to summary
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; for certain styles (currently only delete-orphan), however, we need to be able to control this seperately.

Parameters
action:CascadingAction

The action to be checked for cascade-ability.

Returns:boolean

True if the action should be really cascaded under this style; false otherwise.

org.hibernate.engine back to summary

public final Class CascadeStyle.MultipleCascadeStyle

extends CascadeStyle
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final CascadeStyle[]
Inherited from org.hibernate.engine.CascadeStyle:
ALLALL_DELETE_ORPHANDELETEDELETE_ORPHANEVICTLOCKMERGENONEPERSISTREFRESHREPLICATESTYLESUPDATE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
doCascade(CascadingAction
The action to be checked for cascade-ability.
action
)

Implements abstract org.hibernate.engine.CascadeStyle.doCascade.

For this style, should the given action be cascaded?
public boolean
hasOrphanDelete()

Overrides org.hibernate.engine.CascadeStyle.hasOrphanDelete.

Do we need to delete orphaned collection elements?
public boolean
reallyDoCascade(CascadingAction
The action to be checked for cascade-ability.
action
)

Overrides org.hibernate.engine.CascadeStyle.reallyDoCascade.

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

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.hibernate.engine.CascadeStyle:
getCascadeStyle

Field Detail

stylesback to summary
private final CascadeStyle[] styles

Constructor Detail

MultipleCascadeStyleback to summary
public MultipleCascadeStyle(CascadeStyle[] styles)

Method Detail

doCascadeback to summary
public boolean doCascade(CascadingAction action)

Implements abstract org.hibernate.engine.CascadeStyle.doCascade.

Doc from org.hibernate.engine.CascadeStyle.doCascade.

For this style, should the given action be cascaded?

Parameters
action:CascadingAction

The action to be checked for cascade-ability.

Returns:boolean

True if the action should be cascaded under this style; false otherwise.

hasOrphanDeleteback to summary
public boolean hasOrphanDelete()

Overrides org.hibernate.engine.CascadeStyle.hasOrphanDelete.

Doc from org.hibernate.engine.CascadeStyle.hasOrphanDelete.

Do we need to delete orphaned collection elements?

Returns:boolean

True if this style need to account for orphan delete operations; false othwerwise.

reallyDoCascadeback to summary
public boolean reallyDoCascade(CascadingAction action)

Overrides org.hibernate.engine.CascadeStyle.reallyDoCascade.

Doc from org.hibernate.engine.CascadeStyle.reallyDoCascade.

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; for certain styles (currently only delete-orphan), however, we need to be able to control this seperately.

Parameters
action:CascadingAction

The action to be checked for cascade-ability.

Returns:boolean

True if the action should be really cascaded under this style; false otherwise.

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.