Temporal libraries for Java [closed]
Asked Answered
C

2

9

I'm looking for temporal libraries for Java, i.e. libraries which allow to store multiple historical version of the same concept. I'm looking for a library which has an API to do something like:

Instant i1 = Instant.valueOf("2010-01-01");
Instant i2 = Instant.valueOf("2010-01-02");
Attribute<String> a =  ....
a.setValue(i1, "String as of 2010-01-01");
a.setValue(i2, "String as of 2010-01-02");

You can find a discussion about temporal issues on the nice articles by Martin Fowler

One library I found is JTemporal, which seems pretty good to me, but it's not complete and lacks support for Hibernate persistance. I'd like support for temporal sets too, i.e. sets defined in an exact point in time. JTemporal does that, but persisting the TemporalSet is not easy.

Combination answered 25/10, 2010 at 21:13 Comment(2)
can't you do this with a Map ?Klaus
This is what JTemporal does, but temporal support is much more, like merging adjacent periods with the same value, and much more. The Map, however, is of for a single temporal attribute, but handling temporal sets is more difficultCombination
B
4

Have a look at DaoFusion framework which acts as a bitemporal framework with tight integration into Hibernate. It should be exactly what you are looking for.

Quoted from the linked website:

Bitemporal pattern offers an elegant and sophisticated way of dealing with most temporal issues. The bitemporal pattern implementation offered by DAO Fusion builds upon a bitemporal framework created by Erwin Vervaet and Christophe Vanfleteren. You can learn more about this framework from their presentation Temporal Issues in a Rich Domain Model.

Beefburger answered 25/10, 2010 at 21:34 Comment(2)
I forgot it, but I already examined it. That is good code, but, if I correctly recall, is much similar to JTemporal, and uses the same "trick" which can be used with JTemporal to achieve Hibernate persistance: use an uderlying collection which Hibernate knows hot to map. I'm not sure that is the best approach with Hibernate, and, moreover, this trick cannot be used to store JTemporal TemporalSet, which is a collection of collectionsCombination
That's the way it works.. providing a persistable list to Hibernate and providing a bitemporal object to the application.Beefburger
W
2

Look at Deuce STM - Java Software Transactional Memory.

Wolves answered 25/10, 2010 at 21:21 Comment(2)
Based on description: "allow to store multiple historical version of the same concept"Wolves
+1 Bozho, this has little to do with Fowler's termed "temporal objects"Erubescent

© 2022 - 2024 — McMap. All rights reserved.