Record Class AuditChangeSet.CollectionChange<C>

java.lang.Object
java.lang.Record
org.hibernate.audit.spi.AuditChangeSet.CollectionChange<C>
Type Parameters:
C - the collection audit handler type
Record Components:
collection - the collection wrapper whose final state will be audited
ownerId - the collection owner identifier
originalSnapshot - the original collection snapshot, or null for a new collection
collectionAuditHandler - the execution-specific handler used to consume this change
Enclosing class:
AuditChangeSet<E,C>

public static record AuditChangeSet.CollectionChange<C>(PersistentCollection<?> collection, Object ownerId, Object originalSnapshot, C collectionAuditHandler) extends Record

A collection audit change.

The change stores the original snapshot captured before flush replaces it. Consumers compare that snapshot with the collection wrapper's final state to produce row-level ADD and DEL audit mutations.

Since:
8.0
  • Constructor Details

    • CollectionChange

      public CollectionChange(PersistentCollection<?> collection, Object ownerId, Object originalSnapshot, C collectionAuditHandler)
      Creates an instance of a CollectionChange record class.
      Parameters:
      collection - the value for the collection record component
      ownerId - the value for the ownerId record component
      originalSnapshot - the value for the originalSnapshot record component
      collectionAuditHandler - the value for the collectionAuditHandler record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • collection

      public PersistentCollection<?> collection()
      Returns the value of the collection record component.
      Returns:
      the value of the collection record component
    • ownerId

      public Object ownerId()
      Returns the value of the ownerId record component.
      Returns:
      the value of the ownerId record component
    • originalSnapshot

      public Object originalSnapshot()
      Returns the value of the originalSnapshot record component.
      Returns:
      the value of the originalSnapshot record component
    • collectionAuditHandler

      public C collectionAuditHandler()
      Returns the value of the collectionAuditHandler record component.
      Returns:
      the value of the collectionAuditHandler record component