db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Raphael.X.Mankin%GSK...@gsk.com
Subject DATE and TIMESTAMP in Oracle with Torque 3.1
Date Tue, 15 Jun 2004 13:46:15 GMT

I am using Torque 3.1 with an Oracle DB. I am trying to create tables that
have date/time fields. I find that it makes absolutely no difference
whether in the xml I declare the columns as DATE or TIMESTAMP; the DDL and
code generated are exactly the same. The effect of this is that the time
component of the timesamp is removed before the data is written to the DB.
For both DATE and TIMESTAMP fields the generated columns have SQL type DATE
and java type java.util.Date.

There is a secondary problem. When I retrieve a row from the DB the
constructed date object is of type java.sql.Date instead of java.util.Date.
The causes an InstantiationException when the returned object is
subsequently passed to java.beans.XMLEncoder because the actual value does
not match the declared type. The documentation for java.sql.Date in fact
warns you that it should NOT be taken as a sub-type of java.util.Date.

So, it looks as if we need two fixes:
1. To get full timestamps stored in the DB for Oracle (AFAIK the
implementation is correct for mySQL)
2. To ensure that the actual value of a retrieved date or date/time matches
its declared type.

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message