Enum ConstraintMode

java.lang.Object
java.lang.Enum<ConstraintMode>
io.ebean.annotation.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:
  • Enum Constant Details

    • 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.
    • SET_DEFAULT

      public static final ConstraintMode SET_DEFAULT
      Set the value to 'default' when a referenced id is deleted.
    • CASCADE

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

    • values

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