Skip to main content



      Home
Home » Eclipse Projects » EclipseLink » creating history records - potential clock issues
creating history records - potential clock issues [message #500236] Wed, 25 November 2009 08:12 Go to next message
Eclipse UserFriend
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 09:29 Go to previous messageGo to next message
Eclipse UserFriend
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).
Re: creating history records - potential clock issues [message #500560 is a reply to message #500525] Thu, 26 November 2009 11:53 Go to previous message
Eclipse UserFriend
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: Sun Jul 06 11:33:18 EDT 2025

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

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

Back to the top