Skip to content

Temporal Tables

Konstantin Triger edited this page Aug 15, 2019 · 1 revision

Temporal tables give you the opportunity to time travel. For every data change (Update, Delete and Merge) in your table, a historical copy is stored in a history table. The table on which you enabled this data tracking is changed to a “System-Versioned” table. See SQL Server docs.

FluentJPA:

FOR(Versioning.SYSTEM_TIME).AS_OF(DATE.raw("2001-10-05"));

Oracle has a similar feature, called "Flashback Queries", which is supported as well:

AS_OF(TIMESTAMP.of("2001-10-05"));
AS_OF(PERIOD_FOR("valid_time", TIMESTAMP.of("2001-10-05"));