Interface BeforeSaveCallback<T>

All Superinterfaces:
org.springframework.data.mapping.callback.EntityCallback<T>
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface BeforeSaveCallback<T> extends org.springframework.data.mapping.callback.EntityCallback<T>
Entity callback triggered before save of a row.
Since:
1.2
Author:
Mark Paluch
See Also:
  • ReactiveEntityCallbacks
  • Method Summary

    Modifier and Type
    Method
    Description
    org.reactivestreams.Publisher<T>
    onBeforeSave(T entity, OutboundRow row, SqlIdentifier table)
    Entity callback method invoked before a domain object is saved.
  • Method Details

    • onBeforeSave

      org.reactivestreams.Publisher<T> onBeforeSave(T entity, OutboundRow row, SqlIdentifier table)
      Entity callback method invoked before a domain object is saved. Can return either the same or a modified instance of the domain object and can modify OutboundRow contents. This method is called after converting the entity to a OutboundRow so effectively the row is used as outcome of invoking this callback. Changes to the domain object are not taken into account for saving, only changes to the row. Only transient fields of the entity should be changed in this callback. To change persistent the entity before being converted, use the BeforeConvertCallback.
      Parameters:
      entity - the domain object to save.
      row - OutboundRow representing the entity.
      table - name of the table.
      Returns:
      the domain object to be persisted.