openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <adam....@cyberspaceroad.com>
Subject Re: Time handling in Dates
Date Tue, 10 Mar 2009 17:32:56 GMT

logged in Jira:

https://issues.apache.org/jira/browse/OPENJPA-971

Adam Hardy on 09/03/09 13:25, wrote:
> I have what looks like a bug in time handling, that probably stems from 
> the database Dictionaries. My testing shows it occurs with MySQL and 
> Derby, but not for PostgreSQL, H2 or Hypersonic (using latest GA 
> versions of Java, OpenJPA & JDBC drivers).
> 
> If I save an entity with this set-up, I see incorrect handling of dates:
> 
> class MyEntity
> {
>     ...
>     private java.util.Date opening;
>     ...
> }
> 
> and:
> 
> <entity>
>     <attributes>
>       <basic name="opening">
>         <column name="OPENING"/>
>         <temporal>TIME</temporal>
>       </basic>
>       ...
> 
> and:
> 
> create table MY_ENTITY (
>     ...
>     OPENING time not null,
>     ...
> 
> In my test I assign a new value to 'opening', save the entity and 
> retrieve it from the database again. Then I compare the date on the 
> retrieved entity against the value originally assigned, and I get this 
> result:
> 
> with Derby: original Calendar.HOUR_OF_DAY == 9, retrieved value = 10
> 
> (probably due to Daylight Saving Time handling)
> 
> with MySQL: original Calendar.YEAR == 1970, retrieved value = 1969
> 
> (could be declared irrelevant since the value comes from a Time database 
> type and the Java comparisons should blank out or ignore non-time Date 
> values).
> 
> I couldn't find this in JIRA but thought I'd bring it up here before 
> logging it. I can post a unit test showing the bug. Shall I do that now?
> 
> Regards
> Adam
> 


Mime
View raw message