When attempting to save a LocalDateTime to the database, I am
receiving an error (included below).  My database is Oracle 10g, in
UTC.  My java client is 1.6+, and is running in U.S. Central time
zone.  The time which fails to insert is LocalDateTime(2008,3,9,2,30).
 This time, in the local time zone of the java client, exists in the
DST cutover where 2:00 becomes 3:00. When toDateTime() is called from
within PersistentLocalDateTime.nullSafeSet(), the instant cannot be
created because that instant does not exist in the U.S. Central time
zone.

So, is this behaving as intended, or is it a bug? The description of
LocalDateTime from the javadoc is "a datetime without a time zone".
Is there an additional implication (as the name of the class would
seem to indicate) that the LocalDateTime occurs in the local time zone
of the client that creates it?  Or should a client be able to save a
LocalDateTime object to the database that represents a local time
somewhere other than the client's default time zone?

The error is:
java.lang.IllegalArgumentException: Illegal instant due to time zone
offset transition: 2008-03-09T08:30:00.000
        at 
org.joda.time.chrono.ZonedChronology.localToUTC(ZonedChronology.java:143)
        at 
org.joda.time.chrono.ZonedChronology.getDateTimeMillis(ZonedChronology.java:119)
        at 
org.joda.time.chrono.AssembledChronology.getDateTimeMillis(AssembledChronology.java:133)
        at org.joda.time.base.BaseDateTime.<init>(BaseDateTime.java:254)
        at org.joda.time.DateTime.<init>(DateTime.java:293)
        at org.joda.time.LocalDateTime.toDateTime(LocalDateTime.java:634)
        at org.joda.time.LocalDateTime.toDateTime(LocalDateTime.java:619)
        at 
org.joda.time.contrib.hibernate.PersistentLocalDateTime.nullSafeSet(PersistentLocalDateTime.java:99)
        at org.hibernate.type.CustomType.nullSafeSet(CustomType.java:146)
        at 
org.hibernate.persister.entity.AbstractEntityPersister.dehydrate(AbstractEntityPersister.java:1997)
        at 
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2243)
        at 
org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2660)
        at 
org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:56)
        at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
        at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:141)
        at 
org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
        at 
org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
        at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
        at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
        at 
org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Joda-interest mailing list
Joda-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/joda-interest

Reply via email to