openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Patrick Linskey (JIRA)" <>
Subject [jira] Closed: (OPENJPA-433) Timestamp rounded upon database updating
Date Tue, 06 Nov 2007 06:37:50 GMT


Patrick Linskey closed OPENJPA-433.

    Resolution: Invalid

This is actually intentional, and can be controlled via the DatePrecision DBDictionary setting:

<!-- sets the date precision to milliseconds. Value is in nanos. -->
<property name="openjpa.jdbc.DBDictionary" value="DatePrecision=1000000"/>

You might be able to use the static constants in the DBDictionary class in the property value:

<property name="openjpa.jdbc.DBDictionary" value="DatePrecision=MILLI"/>

OpenJPA does this so that if you load the same record from the DB twice and print out the
timestamp field, you get the same values even if the DB does not have sufficient precision
to represent the full range. In other words, by setting the low bits all to zero, OpenJPA
ensures that only the valid data is available.

> Timestamp rounded upon database updating
> ----------------------------------------
>                 Key: OPENJPA-433
>                 URL:
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: sql
>    Affects Versions: 1.0.0
>         Environment: Postgresql dictionary; unsure if others are affected
>            Reporter: Nick Johnson
>            Priority: Minor
> When updating a Timestamp field, OpenJPA is rounding the time to the nearest hundredth
of a second.  For example, in this case I print the Timestamp to stdout just before committing
the transaction.  Note the difference between the printed time and the time given in the SQL:
> New time is 2007-11-04 21:16:49.906
> 4593  tally_ho  TRACE  [main] openjpa.jdbc.SQL - <t 1205211, conn 6232809> executing
prepstmnt 8529229 UPDATE Article SET create_date = ? WHERE object_id = ? [params=(Timestamp)
2007-11-04 21:16:49.91, (long) 1]
> This is actually causing a unit test of mine (one which checks that the create_date field
updates correctly) to fail.  It's fairly easy to kludge around for now.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message