枚举类 SaveMode

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

public enum SaveMode extends Enum<SaveMode>
Notes, this only affect root objects, not associated objects

To control associated objects, please view AssociatedSaveMode

另请参阅:
  • 枚举常量详细资料

    • UPSERT

      public static final SaveMode UPSERT
      Insert or update the aggregate-root object(s).
      • If it's possible to use low-level database upsert capabilities, the corresponding SQL will be generated.
      • Otherwise, Jimmer will first execute a select statement and decide whether the subsequent operation should be an insert or update based on the query results.

        In this case, the purpose field of the corresponding SQL statement in the SQL log will provide the query reason. Users can refer to QueryReason to understand what happened, in an effort to optimize to the former situation.

    • INSERT_ONLY

      public static final SaveMode INSERT_ONLY
    • UPDATE_ONLY

      public static final SaveMode UPDATE_ONLY
    • NON_IDEMPOTENT_UPSERT

      public static final SaveMode NON_IDEMPOTENT_UPSERT
      This mode is basically the same as UPSERT, but it handles wild objects differently.

      A wild object is an object with neither Id nor Key. The difference between this mode and the UPSERT mode is as follows:

      • UPSERT: Considers wild objects illegal, throws SaveException.NeitherIdNorKey
      • NON_IDEMPOTENT_UPSERT: Ignores the risk of breaking idempotency and unconditionally inserts wild objects.

      This mode is actually similar to the `saveOrUpdate` in other frameworks, so most developers are very familiar with it. However, Jimmer does not recommend this mode because it is really not a good idea.

  • 方法详细资料

    • values

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

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