Search in sources :

Example 1 with ModWorkUnit

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());
        }
    }
}
Also used : AuditProcess(org.hibernate.envers.internal.synchronization.AuditProcess) AuditWorkUnit(org.hibernate.envers.internal.synchronization.work.AuditWorkUnit) ModWorkUnit(org.hibernate.envers.internal.synchronization.work.ModWorkUnit)

Aggregations

AuditProcess (org.hibernate.envers.internal.synchronization.AuditProcess)1 AuditWorkUnit (org.hibernate.envers.internal.synchronization.work.AuditWorkUnit)1 ModWorkUnit (org.hibernate.envers.internal.synchronization.work.ModWorkUnit)1