how does cayenne handle java.util.date values ?

From: Lothar Krenzien (lkrenzie..eb.de)
Date: Tue Dec 05 2006 - 08:26:56 EST

  • Next message: Tore Halset: "Re: how does cayenne handle java.util.date values ?"

    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

    ______________________________________________________________________________
    "Ein Herz für Kinder" - Ihre Spende hilft! Aktion: www.deutschlandsegelt.de
    Unser Dankeschön: Ihr Name auf dem Segel der 1. deutschen America's Cup-Yacht!



    This archive was generated by hypermail 2.0.0 : Tue Dec 05 2006 - 09:28:51 EST