Search in sources :

Example 6 with AggregateChange

use of org.springframework.data.jdbc.core.conversion.AggregateChange in project spring-data-jdbc by spring-projects.

the class JdbcEntityTemplate method save.

@Override
public <T> void save(T instance, Class<T> domainType) {
    JdbcPersistentEntityInformation<T, ?> entityInformation = context.getRequiredPersistentEntityInformation(domainType);
    AggregateChange change = createChange(instance);
    publisher.publishEvent(new // 
    BeforeSave(// 
    Identifier.ofNullable(entityInformation.getId(instance)), // 
    instance, // 
    change));
    change.executeWith(interpreter);
    publisher.publishEvent(new // 
    AfterSave(// 
    Identifier.of(entityInformation.getId(instance)), // 
    instance, // 
    change));
}
Also used : AggregateChange(org.springframework.data.jdbc.core.conversion.AggregateChange)

Aggregations

AggregateChange (org.springframework.data.jdbc.core.conversion.AggregateChange)6 AfterDelete (org.springframework.data.jdbc.mapping.event.AfterDelete)1 BeforeDelete (org.springframework.data.jdbc.mapping.event.BeforeDelete)1 Specified (org.springframework.data.jdbc.mapping.event.Identifier.Specified)1