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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordComplete transaction changeset context produced by aChangelogSupplier. -
Constructor Summary
ConstructorsConstructorDescriptionChangelogSupplier(Class<?> changelogClass, String changesetIdProperty, String timestampProperty, String modifiedEntitiesProperty, ChangesetListener listener) -
Method Summary
Modifier and TypeMethodDescriptiongenerateContext(SharedSessionContract session) Generate the complete changelog context for the current transaction.generateIdentifier(SharedSessionContract session) Called once per transaction to obtain the changeset identifierClass<?> The changelog entity class.The name of the@Changesetproperty.The configured changeset listener, ornull.The name of the@ModifiedEntitiesproperty, ornullif entity change tracking is not configured.The name of the@Timestampproperty.voidregisterLegacyContext(SharedSessionContractImplementor sessionImpl, ChangelogSupplier.ChangesetContext<?> context) Register the generated context with the legacy audit infrastructure.static 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.
-