Small Maven project that demonstrates temporal “chaining” semantics in two ways:
- Reladomo-managed audit-only and bitemporal objects (via Mithra/Reladomo XML mappings + generated code)
- A direct SQL reference implementation in
TemporalSqlStorethat models the same ideas with plain JDBC + H2
- Java 11
- Maven 3.x
Run everything (includes Reladomo code generation during the build):
mvn testOptional:
mvn clean testReladomo object definitions live in:
src/main/resources/mithra/AuditAccount.xml: audit-only (processing-time) mapping usingIN_Z/OUT_Zsrc/main/resources/mithra/BitemporalAccount.xml: bitemporal mapping using:- business time:
FROM_Z/THRU_Z - processing time:
IN_Z/OUT_Z
- business time:
src/main/resources/mithra/MithraClassList.xml: list of objects to generate
Generated sources are written to:
target/generated-sources/reladomo/...(do not edit by hand)
The Reladomo test harness is configured by:
src/test/resources/testconfig/ReladomoTestRuntimeConfiguration.xml(resource name:test_db)src/test/resources/testdata/ReladomoTestData.txt(minimal schema seed used by the test util)
The base test setup is in src/test/java/com/example/reladomo/ReladomoTestBase.java.
AuditOnlyChainingTest: shows audit-only history where each update “closes” the prior row (OUT_Zbecomes the next row’sIN_Z)BitemporalChainingTest: shows business-time corrections (splits/rewrites along business date while preserving processing history)sql/DirectSqlChainingTest: runs the same scenarios viaTemporalSqlStore(no Reladomo), useful for understanding the raw SQL mechanics
- Infinity: “current” rows use a sentinel timestamp (Reladomo uses
DefaultInfinityTimestamp;TemporalSqlStoreuses9999-12-31 23:59:59). - Audit-only: a single timeline (processing-time). Each change:
- updates the current row’s
OUT_Zto “now” - inserts a new row with
IN_Z = nowandOUT_Z = infinity
- updates the current row’s
- Bitemporal: two timelines:
- business validity:
[FROM_Z, THRU_Z) - processing validity:
[IN_Z, OUT_Z)
- business validity:
Business-time corrections are implemented as “rewrite the current business slices, then insert a new processing version”.
src/main/java/com/example/reladomo/sql/TemporalSqlStore.java provides a plain-JDBC implementation against H2 that:
- runs each operation in a single JDBC transaction (
autoCommit=false+ commit/rollback) - uses
SELECT ... FOR UPDATEto lock the current rows for an account during bitemporal rewrites - rewrites business slices in memory (split → merge → validate), then inserts the next processing version