Enum ForeignKeyRule

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<ForeignKeyRule>

    public enum ForeignKeyRule
    extends java.lang.Enum<ForeignKeyRule>
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
      CASCADE
      级联删除,删除包含与已删除键值有参照关系的所有记录
      NO_ACTION
      啥也不做
      RESTRICT
      拒绝删除要求,直到使用删除键值的辅助表被手工删除,并且没有参照时(这是默认设置,也是最安全的设置)
      SET_DEFAULT
      修改包含与已删除键值有参照关系的所有记录,使用默认值替换(只能用于设定了DEFAULT的字段)
      SET_NULL
      修改包含与已删除键值有参照关系的所有记录,使用NULL值替换(只能用于已标记为NOT NULL的字段)
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getRuleName()  
      static ForeignKeyRule valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static ForeignKeyRule[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail

      • NO_ACTION

        public static final ForeignKeyRule NO_ACTION
        啥也不做

        注意: 在Mysql中该选项实际上等同于采用默认的 RESTRICT 设定!

      • RESTRICT

        public static final ForeignKeyRule RESTRICT
        拒绝删除要求,直到使用删除键值的辅助表被手工删除,并且没有参照时(这是默认设置,也是最安全的设置)
      • SET_NULL

        public static final ForeignKeyRule SET_NULL
        修改包含与已删除键值有参照关系的所有记录,使用NULL值替换(只能用于已标记为NOT NULL的字段)
      • SET_DEFAULT

        public static final ForeignKeyRule SET_DEFAULT
        修改包含与已删除键值有参照关系的所有记录,使用默认值替换(只能用于设定了DEFAULT的字段)
      • CASCADE

        public static final ForeignKeyRule CASCADE
        级联删除,删除包含与已删除键值有参照关系的所有记录
    • Method Detail

      • values

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

        public static ForeignKeyRule valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • getRuleName

        public java.lang.String getRuleName()