Annotation Interface Changelog
Marks an entity as the changelog entity for audit logging.
The annotated class must also be annotated
@Entity and must have:
- a field annotated
Changelog.ChangesetId, typically the@Idwith@GeneratedValue, and - a field annotated
Changelog.Timestamp.
@ModifiedEntities
property may be declared to enable cross-type changeset
queries via AuditLog.
The changelog entity is responsible for initializing its own
@Timestamp field, for example, via
CreationTimestamp, in the constructor, or in a
ChangesetListener.
When a class annotated with @Changelog is found
in the domain model, it is automatically configured as the
changeset id supplier, and it is not necessary to explicitly
set the property "hibernate.temporal.changeset_id_supplier".
Only one entity may be annotated with @Changelog.
- Since:
- 7.4
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceMarks the property that holds the changeset identifier in a@Changelog.static @interfaceMarks aSet<String>property of a@Changelogthat holds the names of entity types modified in each changeset.static @interfaceMarks the property that holds the changeset timestamp in a@Changelog. -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionClass<? extends ChangesetListener> An optionalChangesetListenerimplementation that will be called after the changelog entity is created, to populate custom fields (e.g.
-
Element Details
-
listener
Class<? extends ChangesetListener> listenerAn optionalChangesetListenerimplementation that will be called after the changelog entity is created, to populate custom fields (e.g. user, comment).- Default:
org.hibernate.audit.ChangesetListener.class
-