Enum Class TemporalTableStrategy
- All Implemented Interfaces:
Serializable, Comparable<TemporalTableStrategy>, Constable
Enumerates the possible mapping strategies for
temporal
entities and collections.
- Since:
- 7.4
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionLet us choose a temporal table mapping strategy for you because YOLO.Maintain two tables, one for current data and one for historical data.Use native ANSI SQL 2011-style temporal tables where they are supported (Maria, SQL Server, Db2).Store historical data together with current data in one table. -
Method Summary
Modifier and TypeMethodDescriptionstatic TemporalTableStrategyReturns the enum constant of this class with the specified name.static TemporalTableStrategy[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NATIVE
Use native ANSI SQL 2011-style temporal tables where they are supported (Maria, SQL Server, Db2). -
SINGLE_TABLE
Store historical data together with current data in one table. The table does not have the usual foreign key constraints that would exist for any non-temporal entity, and so it is the responsibility of the application program to maintain and enforce referential integrity. -
HISTORY_TABLE
Maintain two tables, one for current data and one for historical data. The table for current data has all the usual foreign key constraints that would exist for any non-temporal entity; the table for historical data has no foreign key constraints.- When a new entity instance is created, a row is inserted in both tables.
- When the instance is updated, its row in the table
for current data is updated; but in the table for
historical data, a new revision row is inserted and
the previous revision row is marked as superseded by
setting its
row endcolumn to the current timestamp. - When an entity instance is removed, its row in the
table for current data is deleted; and the current
revision row in the table for historical data is
marked as superseded by setting its
row endcolumn.
Queries for current data are run against the table for current data. Queries for historical data (that is, any query in a session created using
CommonBuilder.asOf(Instant)) are executed against the table for historical data. -
AUTO
Let us choose a temporal table mapping strategy for you because YOLO. SelectsHISTORY_TABLEexcept on databases with especially robust implementations ofNATIVEtemporal versioning. This is the default.- See Also:
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-