Enum CascadeType

  • All Implemented Interfaces:
    Serializable, Comparable<CascadeType>

    public enum CascadeType
    extends Enum<CascadeType>
    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:

    See Also:
    • Enum Constant Detail

      • ALL

        public static final CascadeType ALL
        Includes all types listed here. Equivalent to CascadeType.ALL.
      • PERSIST

        public static final CascadeType PERSIST
        Equivalent to CascadeType.PERSIST.
        See Also:
      • MERGE

        public static final CascadeType MERGE
        Equivalent to CascadeType.MERGE.
        See Also:
      • REMOVE

        public static final CascadeType REMOVE
        Equivalent to CascadeType.REMOVE.
        See Also:
      • REFRESH

        public static final CascadeType REFRESH
        Equivalent to CascadeType.REFRESH.
        See Also:
      • DETACH

        public static final CascadeType DETACH
        Equivalent to CascadeType.DETACH.
        See Also:

        public static final CascadeType 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).
    • Method Detail

      • values

        public static CascadeType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (CascadeType c : CascadeType.values())
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static CascadeType valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        name - the name of the enum constant to be returned.
        the enum constant with the specified name
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null