Class AuditWorkQueue
java.lang.Object
org.hibernate.audit.spi.AuditWorkQueue
- All Implemented Interfaces:
TransactionCompletionCallbacks.BeforeCompletionCallback, TransactionCompletionCallbacks.CompletionCallback
public class AuditWorkQueue
extends Object
implements TransactionCompletionCallbacks.BeforeCompletionCallback
Transaction-scoped queue for deferred audit row writes.
Mutation coordinators enqueue audit entries instead of writing
them inline during flush. Entries are keyed by
EntityKey. When the same entity is modified
multiple times within a transaction, entries are merged
according to the following merge rules:
- ADD + MOD -> ADD (with latest state)
- ADD + DEL -> entries cancel out (no audit row)
- MOD + MOD -> MOD (with latest state)
- MOD + DEL -> DEL
- DEL + ADD -> MOD (entity re-created with potentially different state)
beforeTransactionCompletion.- Since:
- 7.4
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidPerform whatever processing is encapsulated here before completion of the transaction.voidenqueue(EntityKey entityKey, Object entity, Object[] values, ModificationType modificationType, AuditWriter writer, SharedSessionContractImplementor session) Enqueue an audit entry for deferred writing.voidenqueueCollection(CollectionPersister collectionPersister, PersistentCollection<?> collection, Object ownerId, Object originalSnapshot, CollectionAuditWriter writer, SharedSessionContractImplementor session) Enqueue a collection for deferred audit row writing.voidsetChangesetContext(Object changelog, Session changesetSession) Store the changelog entity and the child session used to persist it.
-
Constructor Details
-
AuditWorkQueue
public AuditWorkQueue()
-
-
Method Details
-
setChangesetContext
Store the changelog entity and the child session used to persist it. The child session is kept open for deferred flush of@ElementCollectionchanges (e.g.@ModifiedEntities). Called fromChangelogSupplier.generateIdentifier(SharedSessionContract).let's