Derby (and H2), for example, store TIMESTAMP values not as a time offset
from some epoch, but as a local datetime value, without time zone
information.

There are two possibilities to map that by JDBC:
1. to java.util.Date, java.sql.Date, java.sql.Timestamp: the JVM's
system time zone is used to convert the database value to a offset
value from the epoch, so the result is dependent on the system time
zone.

2. you can pass a Calendar object to the JDBC getTimestamp() call and
specify the time zone to use.

According to my observations, it seems Cayenne (and the Derby adapter?)
use the first approach. Is it possible to configure it so that a
calendar with UTC is used? I'd like to have a switchable front end time
zone which and application behaviour which is independent of the system
time zone, so I want to store all timestamps as UTC in the database.

The same would apply for DATE and TIME.

A workaround would be to switch the JVM default time zone to UTC on
application startup, but that is not so nice IMO.

Thank you,
Dirk

Reply via email to