Record Class AuditEntry<T>

java.lang.Object
java.lang.Record
org.hibernate.audit.AuditEntry<T>
Type Parameters:
T - the entity type
Record Components:
entity - the entity snapshot after application of the changeset
changeset - the changelog entity (if configured) or changeset identifier
modificationType - the type of modification (ADD/MOD/DEL)

public record AuditEntry<T>(T entity, Object changeset, ModificationType modificationType) extends Record
A tuple representing an entity at a specific changeset in the audit history.

The changeset field holds:

  • the changelog entity instance (e.g. DefaultChangelog), if one is configured, or
  • the plain changeset identifier (e.g. Instant, Integer) otherwise.
Since:
7.4
  • Constructor Details

    • AuditEntry

      public AuditEntry(T entity, Object changeset, ModificationType modificationType)
      Creates an instance of a AuditEntry record class.
      Parameters:
      entity - the value for the entity record component
      changeset - the value for the changeset record component
      modificationType - the value for the modificationType 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.
    • entity

      public T entity()
      Returns the value of the entity record component.
      Returns:
      the value of the entity record component
    • changeset

      public Object changeset()
      Returns the value of the changeset record component.
      Returns:
      the value of the changeset record component
    • modificationType

      public ModificationType modificationType()
      Returns the value of the modificationType record component.
      Returns:
      the value of the modificationType record component