枚举类 DissociateAction

java.lang.Object
java.lang.Enum<DissociateAction>
org.babyfish.jimmer.sql.DissociateAction
所有已实现的接口:
Serializable, Comparable<DissociateAction>, Constable

public enum DissociateAction extends Enum<DissociateAction>
Configuration for many-to-one (or one-to-one) associations directly based on foreign keys.

In the following two cases, the parent object will disassociate from the child objects:

  • When the parent object is deleted (either physically or logically)
  • When the user overrides the parent object using a save command, the collection of child objects in the saved data structure is specified, but does not contain some child objects that already exist in the database, the exists child objects will be deleted (either physically or logically). In this case, each child object will dissociate the grandchild objects.
  • 枚举常量详细资料

    • NONE

      public static final DissociateAction NONE
      The default option, it is equivalent to LAX or CHECK according to the global configuration `jimmer.default-dissociate-action-checking`
    • LAX

      public static final DissociateAction LAX
      Do nothing.

      For physical deletion, if the foreign key constraint exists, `on delete cascade` is required

      This argument can be used config the database-level cascade deletion for foreign key in entity table, for foreign key in middle table, please view JoinTable.cascadeDeletedBySource() and JoinTable.cascadeDeletedByTarget()

    • CHECK

      public static final DissociateAction CHECK
      If the deleted parent object has some child objects, throw an exception to prevent the operation.
    • SET_NULL

      public static final DissociateAction SET_NULL
      If the deleted parent object has some child objects, clear foreign key of child objects.
    • DELETE

      public static final DissociateAction DELETE

      For physical deletion, if the deleted parent object has some child objects, physically delete child objects too.

      For logical deletion, if the deleted parent object has some child objects, logically delete child objects too.

      Notes: If you hope the child objects should be deleted by database through "on delete cascade" option of foreign key of constraint, please don't let ORM to delete them and LAX should be used

  • 方法详细资料

    • values

      public static DissociateAction[] values()
      返回包含该枚举类的常量的数组, 顺序与声明这些常量的顺序相同
      返回:
      包含该枚举类的常量的数组,顺序与声明这些常量的顺序相同
    • valueOf

      public static DissociateAction valueOf(String name)
      返回带有指定名称的该类的枚举常量。 字符串必须与用于声明该类的枚举常量的 标识符完全匹配。(不允许有多余 的空格字符。)
      参数:
      name - 要返回的枚举常量的名称。
      返回:
      返回带有指定名称的枚举常量
      抛出:
      IllegalArgumentException - 如果该枚举类没有带有指定名称的常量
      NullPointerException - 如果参数为空值