Class EntityAuditSupport

java.lang.Object
org.hibernate.persister.entity.mutation.EntityAuditSupport

@Incubating public class EntityAuditSupport extends Object

Shared construction and binding support for audited entity JDBC mutations.

This support deliberately stops at the mutation-model boundary. Legacy coordinators consume the generated mutation groups through the normal mutation executor, while the graph queue turns the same groups into FlushOperations. Keeping the support here avoids teaching either execution path about the other.

The main invariants guarded by this type are:

  • Audit table resolution follows the entity table mappings, including secondary tables and inheritance layouts.
  • Validity-strategy transaction-end updates are generated before the new audit insert and restrict on REVEND is null.
  • Generated graph table descriptors describe the physical audit table used by the JDBC mutation operation, not the original entity table.
Since:
8.0
Implementation Specification:
Used by both graph and legacy action-queue paths. This is just some shared infrastructure.
  • Constructor Details

  • Method Details

    • getEntityPersister

      public EntityPersister getEntityPersister()
    • getAuditedPropertyMask

      public boolean[] getAuditedPropertyMask()

      The per-property audit inclusion mask.

      The returned array is owned by this support instance and must be treated as read-only by callers. It is exposed directly because the legacy audit coordinator keeps a reference for compatibility with its existing shape. Code that needs to alter the mask should first clone it, as [#resolvePropertyInclusions(Object, Object[], SharedSessionContractImplementor)] does.

    • getStaticAuditInsertMutationGroup

      public MutationGroup getStaticAuditInsertMutationGroup()
    • getTransactionEndUpdateMutationGroup

      public MutationGroup getTransactionEndUpdateMutationGroup()
    • resolvePropertyInclusions

      public boolean[] resolvePropertyInclusions(Object entity, Object[] values, SharedSessionContractImplementor session)
    • resolveAuditInsertMutationGroup

      public MutationGroup resolveAuditInsertMutationGroup(boolean[] propertyInclusions, Object entity, SharedSessionContractImplementor session)
    • resolveAuditInsertPlans

      public List<EntityAuditSupport.AuditInsertPlan> resolveAuditInsertPlans(boolean[] propertyInclusions, Object entity, SharedSessionContractImplementor session)

      Resolve the per-table audit insert plans for an audited entity change.

      The returned plans are still execution-agnostic: they identify the JDBC mutation operation and the property inclusion mask needed to bind that operation, but they do not create graph queue FlushOperation instances or legacy mutation executors. The returned insert plans retain an owned copy of the resolved property inclusion mask.

    • resolveTransactionEndUpdatePlans

      public List<EntityAuditSupport.TransactionEndPlan> resolveTransactionEndUpdatePlans()

      Resolve the per-table validity-strategy transaction-end update plans.

      The returned plans describe the update operations needed to close the previous audit rows. Queue-specific code decides how to execute them.

    • bindAuditInsertValues

      public void bindAuditInsertValues(int tableIndex, Object id, Object[] values, boolean[] propertyInclusions, ModificationType modificationType, SharedSessionContractImplementor session, JdbcValueBindings jdbcValueBindings)
    • bindTransactionEndValues

      public void bindTransactionEndValues(int tableIndex, Object id, SharedSessionContractImplementor session, JdbcValueBindings jdbcValueBindings)
    • bindAuditInsertValues

      public void bindAuditInsertValues(int tableIndex, Object id, Object[] values, boolean[] propertyInclusions, ModificationType modificationType, Object changesetId, SharedSessionContractImplementor session, JdbcValueBindings jdbcValueBindings)
    • bindTransactionEndValues

      public void bindTransactionEndValues(int tableIndex, Object id, Object changesetId, SharedSessionContractImplementor session, JdbcValueBindings jdbcValueBindings)
    • verifyTransactionEndOutcome

      public static boolean verifyTransactionEndOutcome(int affectedRowCount, ModificationType modificationType, String entityName, Object id)