-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Time conversion and one hour off with java TimeStamp & m
PostPosted: Tue Apr 25, 2006 1:27 pm 
Newbie

Joined: Tue Apr 25, 2006 1:17 pm
Posts: 19
I have a field of type 'datetime' in a MySQL (5.0) table but when I persist any date/time information, the time is off by one hour in the database but when I print out the information about the object that was persisted, it shows the correct date/time until I re-load it from the database. Is there someplace in the mapping file I need to specify a TimeZone converter or setting? It almost seems like it's a DST shift..

My table is mapped as:
<class name="Event" table="EVENTS">
...
<property name="date" type="timestamp" column="STARTDATETIME"/>.
</class>

When I create a new Event object, I call 'setStartDateTime' with a Timestamp value and the value is correct. I persist the newly created object and then when I look into the database, the time is always one hour behind..


Thanks,
Justin


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 2:17 pm 
Regular
Regular

Joined: Wed Feb 08, 2006 3:59 pm
Posts: 75
I have noticed that on MySQL, when a timestamp column's default value is 'current date' (or something like that), the column value gets updated to now() each time the row is updated.
Is there any chance that you're using a remote database and the server time isn't correct ?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 25, 2006 4:09 pm 
Newbie

Joined: Tue Apr 25, 2006 1:17 pm
Posts: 19
I have the default value of the field in the database as "0000-00-00 00:00:00" and the newly created times aren't equal to "now". And regardless of what time I specify, the database gets the value as 1 hour behind the specified time.

Thanks,
Justin


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.