use of org.hibernate.envers.internal.synchronization.work.ModWorkUnit in project hibernate-orm by hibernate.
the class EnversPostUpdateEventListenerImpl method onPostUpdate.
@Override
public void onPostUpdate(PostUpdateEvent event) {
final String entityName = event.getPersister().getEntityName();
if (getEnversService().getEntitiesConfigurations().isVersioned(entityName)) {
checkIfTransactionInProgress(event.getSession());
final AuditProcess auditProcess = getEnversService().getAuditProcessManager().get(event.getSession());
Object[] oldState = getOldDBState(auditProcess, entityName, event);
final Object[] newDbState = postUpdateDBState(event);
final AuditWorkUnit workUnit = new ModWorkUnit(event.getSession(), event.getPersister().getEntityName(), getEnversService(), event.getId(), event.getPersister(), newDbState, oldState);
auditProcess.addWorkUnit(workUnit);
if (workUnit.containsWork()) {
generateBidirectionalCollectionChangeWorkUnits(auditProcess, event.getPersister(), entityName, newDbState, oldState, event.getSession());
}
}
}
Aggregations