db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From T E Schmitz <m...@numerixtechnology.de>
Subject Re: PostgreSQL TIMESTAMP comparison fails
Date Wed, 14 Apr 2004 10:12:52 GMT
Just to prevent other people from falling into the same trap, here's 
what caused the TIMESTAMP comparison to fail:

When updating the record I had provided the setter method setTimestamp 
in BaseXxx.java with a java.util.Date. This was with hindsight maybe 
rather stupid but I did that because I saw the BaseXxx class declare it 
as java.util.Date.

When fetched from the database, somewhere in the Torque runtime the 
timestamp is declared as java.sql.Timestamp which is a subclass of 
java.util.Date and as such adds nanosecond precision. While setting the 
TIMESTAMP column with a java.util.Date is syntactically correct, it 
causes later comparisons to fail.

I am still not quite sure where I could / should have seen that a 
java.sql.Timestamp was required to handle TIMESTAMP columns.

Question to the Torque developers: would it not be wiser to declare 
timestamps as java.sql.Timestamp in the generated code?

Best Regards,

Tarlika Elisabeth Schmitz

>> doDelete does not delete the record as the following WHERE clause 
>> returns no results: 

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

View raw message