Enum ConstraintMode

  • All Implemented Interfaces:
    Serializable, Comparable<ConstraintMode>

    public enum ConstraintMode
    extends Enum<ConstraintMode>
    Modes for the DbForeignKey onDelete and onUpdate clause of a foreign keys.

    Note that we should never change the onUpdate clause as primary keys should never change. Instead review the design ensuring the primary keys are immutable. Always leave the onUpdate mode at it's default of RESTRICT ('No Action').

    See Also:
    DbForeignKey
    • Enum Constant Detail

      • RESTRICT

        public static final ConstraintMode RESTRICT
        Restrict - The usual default behavior for foreign constraints (also known as 'No Action').
      • SET_NULL

        public static final ConstraintMode SET_NULL
        Set the value to null when a referenced id is deleted.
      • CASCADE

        public static final ConstraintMode CASCADE
        Cascade - To automatically cascade a delete of a referenced id.
    • Method Detail

      • values

        public static ConstraintMode[] 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 (ConstraintMode c : ConstraintMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static ConstraintMode 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.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null