Interface BeforeSaveCallback<T>
- All Superinterfaces:
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.
Entity callback invoked before inserting or updating a row in the database. Before save is invoked after
converting the entity
into a Statement
. This is useful to let the mapping layer
derive values into the statement while the save callback can either update the domain object without reflecting the
changes in the statement. Another use is to inspect the Statement
.- Since:
- 2.2
- Author:
- Mark Paluch
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiononBeforeSave
(T entity, com.datastax.oss.driver.api.core.CqlIdentifier tableName, com.datastax.oss.driver.api.core.cql.Statement<?> statement) Entity callback method invoked before save.
-
Method Details
-
onBeforeSave
T onBeforeSave(T entity, com.datastax.oss.driver.api.core.CqlIdentifier tableName, com.datastax.oss.driver.api.core.cql.Statement<?> statement) Entity callback method invoked before save. That is, before running theINSERT
/UPDATE
Statement
derived from the intent to save an object. Can return either the same of a modified instance of the domain object and can inspect theStatement
contents. This method is called after converting theentity
toStatement
so effectively the entity is propagated as outcome of invoking this callback.- Parameters:
entity
- the domain object to save.tableName
- name of the table.statement
-Statement
representing theentity
operation.- Returns:
- the domain object to be persisted.
-