Jadira is the home for Sousan and Chris Pheby's open source projects. These are reusable open source Java modules that provide first class solutions using the most effective current JEE technologies.

Tag Cloud

Jadira Support > Why don't you use milliseconds in TimestampColumnDateTimeMapper?

We're using TimestampColumnDateTimeMapper in our project and ran intro troubles regarding conversion from Timestamp to DateTime and vice versa. The problems were found to come from different timezone settings from TimestampColumnDateTimeMapper and our Oracle database.

Our database runs with UTC+1 timezone setting and the default setting for Jadira is UTC+0. Therefore we recognized a strange behaviour. The timestamp we created in our application was somehow mangled and stored wrong, with a different time, into database.

The only solution we found so far is to set "databaseZone" to "jvm" and ensure, that our JVM runs with the same timezone setting as the Oracle database.
We dug deeper into the code of TimestampColumnDateTimeMapper and found the real source of the problem, that comes from, as we believe, the intermediate transformation into a String.
We also found that in former versions of the library the conversion was performed by using the millisecond value retrieved from Timestamp, respectively from DateTime in the other direction.

Why did you choose the String approach for doing the conversion? We're thinking about implementing the conversion on our own, by using the millisecond value.

March 4, 2013 | Unregistered CommenterJ-Sharp


Thanks for the report, please share the database version you are using and if its available I'll look at adding a test profile for it to reproduce the issue.

Regards Chris

March 23, 2013 | Registered CommenterChris