Re: how does cayenne handle java.util.date values ?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Dec 05 2006 - 09:38:15 EST

  • Next message: Peter Schröder: "AW: updating large number of data"

    Attachments are stripped from the messages sent to the list, so I
    can't check your example. So let me ask you this - are you using
    Cayenne XMLEncoder/XMLDecoder? It won't handle the dates properly ...
    the rest of Cayenne will. If this doesn't help, could you please post
    a relevant code example inline (not as an attachment).

    Andrus

    On Dec 5, 2006, at 3:26 PM, Lothar Krenzien wrote:

    > Hi there,
    >
    > I posted this yesterday again. But have just seen that I forgott
    > the subject. Sorry for that
    > What I would like to know is how does cayenne handle java.util.date
    > values ?
    >
    > My problem is, that I have to import xml files with datetime values
    > in it of different timezones. For example the file contains the
    > following tag: date="30.11.2006 22:14:28". In my case it should
    > represents a datetime value of german format (dd.MM.yyyy hh.mm.ss)
    > BUT in local korean time. Korean time has an offset of +9h to GMT.
    > So in GMT the time part is "13:14:28" and in german time (GMT +1h)
    > it's "14:14:28". For some "historical" reasons I have to persistent
    > the local datetime value ("28.10.2006 22:14:28"), but of course as
    > date object instead of a string value.
    >
    > When I now try to convert the string value into a date-object using
    > standard java methods I will get an object which reflects GMT time.
    > But when I try to print it out on a console it will be converted to
    > local date (thus german date). And that date will be saved by
    > cayenne in the database. So for me it looks like that cayenne
    > tries to call toString() on the date object and will get a
    > recalculated date instead of the original date. If it's true I
    > think it would be better to use a SimpleDateFormatter instance
    > because than the you will get a correct datetime string.
    >
    > I've provided a simple demo class to show what I mean. I used Java
    > 5, cayenne 2.1 and jtds with MS SQL Server 2000.
    >
    > Thanks
    > Lothar
    >



    This archive was generated by hypermail 2.0.0 : Tue Dec 05 2006 - 09:38:48 EST