Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » creating history records - potential clock issues
creating history records - potential clock issues [message #500236] Wed, 25 November 2009 13:12 Go to next message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 817
Registered: July 2009
Senior Member
I've activated a history policy on one entity now. What I immediately noticed is that the start and end time values are provided as literal values. This is a potential source of problems.

My applications are Swing fat clients. Because the values are literal values derived from the client's clock, issues with differences in the clocks on the clients maybe garble the data. Suppose one client has a clock that differs a few seconds from another client's (not uncommon). That may cause the start-end time to not be in sequence, or even worse: duplicate values (I set the timestamp to milliseconds to try and prevent that last one).

Naturally clock sync will cure this somewhat, but it's an external solution to what could also be solved internally by using the clock of the database instead of the client; by not providing literal values, but database variables. So instead of "2009-11-25 13:59:00.000" provide (in my case of using Informix's datetime) "current year to fraction".

Since using database variables is depending on the field type, default behavior should still be literal values, but configurable to use database variables.

Tom
Re: creating history records - potential clock issues [message #500525 is a reply to message #500236] Thu, 26 November 2009 14:29 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

The HistoryPolicy uses the local time by default, you can change this to the database using,


policy.setShouldUseDatabaseTime(true);

You also need to ensure your DatabasePlatform implements the getTimestampQuery() method (most supported platforms do).


James : Wiki : Book : Blog : Twitter
Re: creating history records - potential clock issues [message #500560 is a reply to message #500525] Thu, 26 November 2009 16:53 Go to previous message
Tom Eugelink is currently offline Tom EugelinkFriend
Messages: 817
Registered: July 2009
Senior Member
James wrote:
> The HistoryPolicy uses the local time by default, you can change this to
> the database using,


Briljant. I still need to run into the first problem that EclipseLink doesn't have a solution for.

Tom
Previous Topic:Big Picture
Next Topic:Why does weaving prevent initalization of class variable
Goto Forum:
  


Current Time: Thu Mar 28 12:10:30 GMT 2024

Powered by FUDForum. Page generated in 0.02595 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top