-->
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.  [ 2 posts ] 
Author Message
 Post subject: Comparing java.util.Date s in HQL
PostPosted: Mon Jan 12, 2004 8:40 pm 
Newbie

Joined: Wed Oct 08, 2003 7:42 pm
Posts: 18
Hi,

I have a problem when i try to compare a java.util.Date with a persisted java.util.Date in a postgres database using HQL. Basically when the util.date is stored in the DB it is stored as a timestamp with a timezone. When i compare a date created by a user in my java app with the persisted date in the database i'm am not getting correct results. I think it is because of the timezone offset.

When i change the database date to a timestamp without a timezone my comparisons worked fine.

At the moment my date is mapped as a util.Date. How can i map it so that Hibernate knows not to interpret timezones. I.e. as a timestamp without a timezone.

Any help would be great!

Scott.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 19, 2004 5:46 am 
Senior
Senior

Joined: Wed Aug 27, 2003 4:08 am
Posts: 178
Location: Wiesbaden, Germany
I'm always storing the date as Date.getTime() value - it' s comparable, and not affected by timezones...

regards,


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.