Package org.hibernate.annotations
Enum Class CascadeType
- All Implemented Interfaces:
Serializable
,Comparable<CascadeType>
,java.lang.constant.Constable
Enumerates the persistence operations which may be cascaded from
one entity instance to associated entity instances.
This enumeration of cascade types competes with the JPA-defined
enumeration CascadeType
, but offers
additional options, including LOCK
.
To enable cascade LOCK
, use @Cascade
, for
example:
@OneToMany(mappedBy="parent") @Cascade({PERSIST,REFRESH,REMOVE,LOCK}) Set<Child> children;
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionIncludes all types listed here.Deprecated.Ancient versions of Hibernate treated orphan removal as a specialized type of cascade.Equivalent toCascadeType.DETACH
.A cascade type for thelock()
operation.Equivalent toCascadeType.MERGE
.Equivalent toCascadeType.PERSIST
.Equivalent toCascadeType.REFRESH
.Equivalent toCascadeType.REMOVE
.Deprecated.sinceSession.replicate(Object, ReplicationMode)
is deprecatedDeprecated.sinceSession.saveOrUpdate(Object)
is deprecated -
Method Summary
Modifier and TypeMethodDescriptionstatic CascadeType
Returns the enum constant of this class with the specified name.static CascadeType[]
values()
Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
ALL
Includes all types listed here. Equivalent toCascadeType.ALL
. -
PERSIST
Equivalent toCascadeType.PERSIST
.- See Also:
-
MERGE
Equivalent toCascadeType.MERGE
.- See Also:
-
REMOVE
Equivalent toCascadeType.REMOVE
.- See Also:
-
REFRESH
Equivalent toCascadeType.REFRESH
.- See Also:
-
DETACH
Equivalent toCascadeType.DETACH
.- See Also:
-
LOCK
A cascade type for thelock()
operation.This cascade type has no equivalent in JPA.
- See Also:
-
DELETE
Deprecated.sinceSession.delete(Object)
is deprecatedA cascade type for thedelete()
operation.This is actually a synonym for
REMOVE
.- See Also:
-
SAVE_UPDATE
Deprecated.sinceSession.saveOrUpdate(Object)
is deprecatedA cascade type for thesaveOrUpdate()
operation.- See Also:
-
REPLICATE
Deprecated.sinceSession.replicate(Object, ReplicationMode)
is deprecatedA cascade type for thereplicate()
operation. -
DELETE_ORPHAN
Ancient versions of Hibernate treated orphan removal as a specialized type of cascade. But since JPA 1.0, orphan removal is considered a completely separate setting, and may be enabled by annotating a one-to-one or one-to-many association@OneToOne(orphanRemoval=true)
or@OneToMany(orphanRemoval=true)
.- API Note:
- This is now valid only for internal usage.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum class has no constant with the specified nameNullPointerException
- if the argument is null
-
Session.delete(Object)
is deprecated