-->
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: local time problem
PostPosted: Wed Aug 01, 2007 2:20 pm 
Newbie

Joined: Mon Aug 15, 2005 3:43 am
Posts: 15
Hi,
I faced a problem with querying for local times in hibernate.
Suppose I have a table with a time( without date) field in it. I want to query it for a specific local date. I create a Calendar, set the TimeZone and time; and I expect hibernate to get the time in the specified timezone when setting the parameter for the query; but instead hibernate gets the time at the default time zone.
Is there an easy way to get my desired behavior from the hibernate?


Top
 Profile  
 
 Post subject: UserType
PostPosted: Wed Aug 01, 2007 5:38 pm 
Newbie

Joined: Fri Apr 07, 2006 11:29 am
Posts: 17
You could achieve this with a custom UserType. Other than the UserType method, I do not know another way off the top of my head.

Example:
http://www.hibernate.org/265.html

You could even make it a parameterized user type. Basically, the nullSafeGet will have to apply the timezone information, while the set will have to apply the timezone for the DB.


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.