Class IdGeneratingEntityCallback
java.lang.Object
org.springframework.data.jdbc.core.convert.IdGeneratingEntityCallback
- All Implemented Interfaces:
EntityCallback<Object>,BeforeSaveCallback<Object>
Callback for generating identifier values through a database sequence.
- Since:
- 3.5
- Author:
- Mikhail Polivakha, Mark Paluch
-
Constructor Summary
ConstructorsConstructorDescriptionIdGeneratingEntityCallback(MappingContext<RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> context, Dialect dialect, NamedParameterJdbcOperations operations) -
Method Summary
Modifier and TypeMethodDescriptiononBeforeSave(Object aggregate, MutableAggregateChange<Object> aggregateChange) Entity callback method invoked before an aggregate root is saved.
-
Constructor Details
-
IdGeneratingEntityCallback
public IdGeneratingEntityCallback(MappingContext<RelationalPersistentEntity<?>, ? extends RelationalPersistentProperty> context, Dialect dialect, NamedParameterJdbcOperations operations)
-
-
Method Details
-
onBeforeSave
Description copied from interface:BeforeSaveCallbackEntity callback method invoked before an aggregate root is saved. Can return either the same or a modified instance of the aggregate and can modifyMutableAggregateChangecontents. This method is called after converting theaggregatetoMutableAggregateChange. Changes to the aggregate are not taken into account to decide whether the change will be an insert or update. Use theBeforeConvertCallbackto change the persistent the entity before being converted.- Specified by:
onBeforeSavein interfaceBeforeSaveCallback<Object>- Parameters:
aggregate- the aggregate.aggregateChange- the associatedMutableAggregateChange.- Returns:
- the aggregate object to be persisted.
-