Beginner |
|
Joined: Fri Oct 10, 2003 4:54 pm Posts: 26 Location: Chicago, IL
|
Along the lines of a customer persister approach, you could define a utility class that periodically queries the actual database for the current timestamp.
If you are willing to sacrifice some accuracy for performance, you can set this class up so that it only periodically queries the database and stores a "drift" value from the current system clock. (You lose the nanosecond precision of database timestamps because System.currentTimeMillis() doesn't support nanoseconds, plus you lose the accuracy of your own system clocks drift in between polling intervals.)
Some sample SQL to query the current timestamp for DB2 would be:
SELECT CURRENT TIMESTAMP FROM SYSIBM.SYSDUMMY
I'm not sure offhand what the SQL for MySQL would be, but it should be similar (you might need to setup a "dummy" table with a single row to make this work).
|
|