Long story short, due to a REALLY poor design by a subcontractor, our time
and time zone data are stored in separate fields in our postgres database.
The time field is timestamp without timezone and the time zone field is a
string (varchar).  The data is read as "the <time> at <time zone>" - meaning
the <time> is generic.  E.g., if <time> were '2010-05-03 18:04:00' and <time
zone> were 'America/New_York' then it would be May 3, 2010 at 6:04PM Eastern
Time.

In a perfect world, I would like be able to pull both bits of data
simultaneously (via annotations) and store in an Entity field whereby the
field's datatype is a DateTime object set to the specified date and time at
the specified time zone.

We've tried several different things but are seeing some really weird
behavior.  For example, if we add a listener to when the Entity is loaded so
that we can post process a separate date/time field, we notice that the time
is being pulled from the database in local time (Mountain Time) and then
'converted' to the specified time zone - meaning the time is actually
adjusted - something we don't want.

It seems like the only way to prevent this would be to have Hibernate
properly retrieve BOTH data fields and construct a DateTime object from both
values.  I think the issue is that DateTime must have a time zone whereas a
Java Date object does not and maybe this is the work-around until we can fix
our data.

Anyone have some ideas on this?  Thanks.

--adam
<http://gordonizer.com>
------------------------------------------------------------------------------
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to