Interface ChangesetCoordinator
- All Superinterfaces:
Serializable, Service
Changeset ids produced by the supplier must be distinct and monotonically increasing. Note, however, that unless the database is in serializable isolation mode, transactions themselves do not have a well-defined total order. Therefore, the changeset ids are ordered by the moment at which they are obtained; approximately, by the instant at which the transaction started. This must be taken into account when interpreting the results of historical queries against a temporal table or audit log. The historical changes cannot be linearized by transaction completion time, since the completion time of a transaction is never known when the records are written to the history table or audit log.
- Since:
- 7.4
- API Note:
- A changeset id or timestamp is assumed to be constant during a transaction. This service is not aware of transaction contexts, and so it is the responsibility of the client to ensure that the supplier is called no more than once in a transaction.
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> voidcontributeIdentifierSupplier(ChangesetIdentifierSupplier<T> supplier, Class<T> identifierType) Programmatically contribute aChangesetIdentifierSupplier, overriding any previously configured supplier.A supplier of changeset identifiers or timestamps.Class<?> The Java type of the changeset identifiers or timestamps.booleanWhether the changeset identifiers are actually timestamps.booleanuseServerTimestamp(Dialect dialect) Whether the stable timestamps assigned by the database server so that multiple calls tocurrent_timestampin the same transaction return the same value.
-
Method Details
-
getIdentifierType
Class<?> getIdentifierType()The Java type of the changeset identifiers or timestamps. -
getIdentifierSupplier
ChangesetIdentifierSupplier<?> getIdentifierSupplier()A supplier of changeset identifiers or timestamps. The current session is passed to the supplier.- See Also:
-
useServerTimestamp
Whether the stable timestamps assigned by the database server so that multiple calls tocurrent_timestampin the same transaction return the same value. When this is true, we don't need to pass the transaction timestamp via a JDBC parameter, and we don't need to cache its value in the session.- See Also:
-
isIdentifierTypeInstant
boolean isIdentifierTypeInstant()Whether the changeset identifiers are actually timestamps. -
contributeIdentifierSupplier
default <T> void contributeIdentifierSupplier(ChangesetIdentifierSupplier<T> supplier, Class<T> identifierType) Programmatically contribute aChangesetIdentifierSupplier, overriding any previously configured supplier.Called during bootstrap (e.g. from the session factory) when a supplier is derived from metadata rather than from explicit configuration.
- Parameters:
supplier- the supplier to useidentifierType- the Java type of changeset identifiers produced by the supplier
-