Search in sources :

Example 6 with AuditWorkUnit

use of org.hibernate.envers.internal.synchronization.work.AuditWorkUnit in project hibernate-orm by hibernate.

the class EnversPostDeleteEventListenerImpl method onPostDelete.

@Override
public void onPostDelete(PostDeleteEvent event) {
    final String entityName = event.getPersister().getEntityName();
    if (getEnversService().getEntitiesConfigurations().isVersioned(entityName)) {
        checkIfTransactionInProgress(event.getSession());
        final AuditProcess auditProcess = getEnversService().getAuditProcessManager().get(event.getSession());
        final AuditWorkUnit workUnit = new DelWorkUnit(event.getSession(), event.getPersister().getEntityName(), getEnversService(), event.getId(), event.getPersister(), event.getDeletedState());
        auditProcess.addWorkUnit(workUnit);
        if (workUnit.containsWork()) {
            generateBidirectionalCollectionChangeWorkUnits(auditProcess, event.getPersister(), entityName, null, event.getDeletedState(), event.getSession());
        }
    }
}
Also used : AuditProcess(org.hibernate.envers.internal.synchronization.AuditProcess) DelWorkUnit(org.hibernate.envers.internal.synchronization.work.DelWorkUnit) AuditWorkUnit(org.hibernate.envers.internal.synchronization.work.AuditWorkUnit)

Aggregations

AuditWorkUnit (org.hibernate.envers.internal.synchronization.work.AuditWorkUnit)6 AuditProcess (org.hibernate.envers.internal.synchronization.AuditProcess)3 Serializable (java.io.Serializable)1 RevisionType (org.hibernate.envers.RevisionType)1 PersistentCollectionChangeData (org.hibernate.envers.internal.entities.mapper.PersistentCollectionChangeData)1 IdMapper (org.hibernate.envers.internal.entities.mapper.id.IdMapper)1 AddWorkUnit (org.hibernate.envers.internal.synchronization.work.AddWorkUnit)1 CollectionChangeWorkUnit (org.hibernate.envers.internal.synchronization.work.CollectionChangeWorkUnit)1 DelWorkUnit (org.hibernate.envers.internal.synchronization.work.DelWorkUnit)1 FakeBidirectionalRelationWorkUnit (org.hibernate.envers.internal.synchronization.work.FakeBidirectionalRelationWorkUnit)1 ModWorkUnit (org.hibernate.envers.internal.synchronization.work.ModWorkUnit)1 PersistentCollectionChangeWorkUnit (org.hibernate.envers.internal.synchronization.work.PersistentCollectionChangeWorkUnit)1