Today I noticed that my timestamp property was being saved with only the date information, not the time information. That is when I queried the corresponding column I saw something like this.
> select TO_CHAR(timestamp, 'yyyy-mm-dd hh24:mi:ss') from foo; 2007-11-17 00:00:00
The timestamp property was represented in Java using a
Date class. I thought of switching it to a
Timestamp class but was dubious because the only real difference is that the Timestamp class stores fractional seconds.
Then I looked at
/atg/commerce/order/orderrepository.xml and the corresponding
OrderImpl.java and realized that it used the timestamp repository data type while I was using the date repository date type. Since the Oracle column data type was also timestamp I found when I switched the repository data type the time information was also saved.
> select TO_CHAR(timestamp, 'yyyy-mm-dd hh24:mi:ss') from foo; 2007-11-17 20:03:00
The moral of the story is to use the timestamp repository data type, not the date repository data type.
ATG has more documentation about this though it is not entirely true, i.e. you can use the Date Java class type with the timestamp SQL type.