Hi there,

I would like to know how cayenne handles java.util.date values. 

My problem is, that I have to import xml files with datetime values of 
different timezones. For example the file consits 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 "15: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 the 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!

Reply via email to