Class ChangelogSupplier<T>
java.lang.Object
org.hibernate.audit.spi.ChangelogSupplier<T>
- Type Parameters:
T- the type of the changeset identifier (the@ChangesetIdproperty type)
- All Implemented Interfaces:
ChangesetIdentifierSupplier<T>
A built-in
ChangesetIdentifierSupplier that persists
a user-defined changelog entity and returns the
@Changelog.ChangesetId
property value as the changeset id for audit rows.
An optional ChangesetListener callback can be
configured for populating custom fields.
- Since:
- 7.4
-
Constructor Summary
ConstructorsConstructorDescriptionChangelogSupplier(Class<?> changelogClass, String changesetIdProperty, String timestampProperty, @Nullable String modifiedEntitiesProperty, @Nullable ChangesetListener listener) -
Method Summary
Modifier and TypeMethodDescriptiongenerateIdentifier(SharedSessionContract session) Called once per transaction to obtain the changeset identifierClass<?> The changelog entity class.The name of the@Changesetproperty.@Nullable ChangesetListenerThe configured changeset listener, ornull.@Nullable StringThe name of the@ModifiedEntitiesproperty, ornullif entity change tracking is not configured.The name of the@Timestampproperty.static @Nullable ChangelogSupplier<?> resolve(ServiceRegistry registry) Resolve theChangelogSupplierfrom the given service registry, or returnnullif no@Changelogis configured.
-
Constructor Details
-
ChangelogSupplier
public ChangelogSupplier(Class<?> changelogClass, String changesetIdProperty, String timestampProperty, @Nullable String modifiedEntitiesProperty, @Nullable ChangesetListener listener) - Parameters:
changelogClass- the changelog entity classchangesetIdProperty- the name of the@ChangesetIdpropertytimestampProperty- the name of the@TimestamppropertymodifiedEntitiesProperty- the name of the@ModifiedEntitiesproperty, ornullif entity change tracking is not configuredlistener- optional callback for populating custom fields
-
-
Method Details
-
getChangelogClass
The changelog entity class. -
getChangesetIdProperty
The name of the@Changesetproperty. -
getTimestampProperty
The name of the@Timestampproperty. -
getListener
The configured changeset listener, ornull. -
getModifiedEntitiesProperty
The name of the@ModifiedEntitiesproperty, ornullif entity change tracking is not configured. -
resolve
Resolve theChangelogSupplierfrom the given service registry, or returnnullif no@Changelogis configured.
-