-->
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: Storing date-times in GMT -- Implications?
PostPosted: Sat Apr 09, 2005 10:37 am 
Regular
Regular

Joined: Thu Oct 07, 2004 4:45 pm
Posts: 92
Hi,

We need two machines with different time zone settings to read and write date-time values to a common database. It seems to make sense to store all dates in GMT (UTC) and convert to the local time zone via a UserType. I've read the forum postings and Wiki page on this topic at:

http://www.hibernate.org/100.html

What's still not clear, though, is how the use of a UserType affects parameterized queries that involve java.util.Dates as parameters. Will they work correctly, assuming we set the parameter type to that of the UserType? Is anyone using this approach successfully?

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 28, 2005 4:14 pm 
Regular
Regular

Joined: Thu Oct 07, 2004 4:45 pm
Posts: 92
Well, I'm going to give the user type approach a try.

Related question: I want to write an automated test that verifies that all Date and Calendar properties are mapped to one of the UTC-aware user types. I know I can use SessionFactory.getAllClassMetadata to get all of the entity classes and loop through their properties, but how can I find all of the classes that are mapped as components, composite-elements, etc. and loop through their properties?

Is there a better way to do this? I thought about replacing Hibernate's built in date/time types with the modified versions, but that seems very invasive, and I'm guessing it will break when date/times are used as query parameters. Or will it?


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.