接口 DraftHandler<D extends org.babyfish.jimmer.Draft,E>

类型参数:
D - The draft type
E - The entity type

public interface DraftHandler<D extends org.babyfish.jimmer.Draft,E>
Complexer DraftInterceptor, before saving draft, query the original entity with `id`, `key` and other properties returned by dependencies()

The default behavior of `save` with `UPDATE_ONLY` or `update` is not querying original entity. However, if dependencies() returns some properties which is neither `id` nor `key`, the default behavior will be broken, original entity will be queried even if the save mode is `UPDATE_ONLY`

  • 方法概要

    修饰符和类型
    方法
    说明
    void
    beforeSave(D draft, E original)
    Adjust draft before save
    default Collection<org.babyfish.jimmer.meta.ImmutableProp>
    Specify which properties of original entity must be loaded
  • 方法详细资料

    • beforeSave

      void beforeSave(@NotNull D draft, @Nullable E original)
      Adjust draft before save
      参数:
      draft - The draft can be modified, `id` and `key` properties cannot be changed, otherwise, exception will be raised.
      original - The original object
      • null for insert
      • non-null for update, with `id`, `key` and other properties returned by dependencies()
    • dependencies

      default Collection<org.babyfish.jimmer.meta.ImmutableProp> dependencies()
      Specify which properties of original entity must be loaded

      Note

      • The return value must be stable, It will only be called once, so an unstable return is meaningless
      • All elements must be properties which is mapped by database field directly
      返回:
      The properties must be loaded, can return null.