Class BeforeSaveEvent<E>
java.lang.Object
java.util.EventObject
org.springframework.context.ApplicationEvent
org.springframework.data.relational.core.mapping.event.AbstractRelationalEvent<E>
org.springframework.data.relational.core.mapping.event.RelationalEventWithEntity<E>
org.springframework.data.relational.core.mapping.event.RelationalSaveEvent<E>
org.springframework.data.relational.core.mapping.event.BeforeSaveEvent<E>
- All Implemented Interfaces:
Serializable
,ResolvableTypeProvider
,RelationalEvent<E>
,WithAggregateChange<E>
,WithEntity<E>
Gets published before changes are applied to the database, after the aggregate was converted to a database change.
The persisting process works as follows:
- A decision is made, if the aggregate is new and therefore should be inserted or if it is not new and therefore should be updated.
BeforeConvertCallback
andBeforeConvertEvent
get published.- An
AggregateChange
object is created for the aggregate. It includes theDbAction
instances to be executed. This means that all the deletes, updates and inserts to be performed are determined. These actions reference entities of the aggregates in order to access values to be used in the SQL statements. This step also determines if the id of an entity gets passed to the database or if the database is expected to generate that id. BeforeSaveCallback
andBeforeSaveEvent
get published.- SQL statements get applied to the database.
AfterSaveCallback
andAfterSaveEvent
get published.
- Author:
- Jens Schauder
- See Also:
-
Field Summary
Fields inherited from class java.util.EventObject
source
-
Constructor Summary
Constructors -
Method Summary
Methods inherited from class org.springframework.data.relational.core.mapping.event.RelationalSaveEvent
getAggregateChange
Methods inherited from class org.springframework.data.relational.core.mapping.event.RelationalEventWithEntity
getEntity, getType
Methods inherited from class org.springframework.context.ApplicationEvent
getTimestamp
Methods inherited from class java.util.EventObject
getSource, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.springframework.data.relational.core.mapping.event.RelationalEvent
getResolvableType, getType
-
Constructor Details
-
BeforeSaveEvent
- Parameters:
instance
- the entity about to get saved. Must not be null.change
- theAggregateChange
that is going to get applied to the database. Must not be null.
-