cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Poulsen <>
Subject Timestamps not working for me in PostgreSQL 8.0
Date Thu, 21 Sep 2006 22:16:04 GMT
Hi guys,

I've been having some trouble with <subj>, I hope someone have an 
reasonable explaination. :)

I've generated both my classes and db schema using the v1.2 modeller. 

The problem is that when I try to access a field in the generated class 
I get a class cast exception in the getter below:

    public void setFromDate(java.sql.Timestamp fromDate) {
        writeProperty("fromDate", fromDate);
    public java.sql.Timestamp getFromDate() {
        return (java.sql.Timestamp)readProperty("fromDate");

The type of "fromDate" is java.util.Date - I'm not even able to select 
that type in the modeller and the types are set to timestamps 
everywhere in the modeller/db.

I can get my code to behave as I expect if i return a:
 new Timestamp( ( (Date)readProperty("fromDate) ).getTime() )
in the getter instead. My query is basically a select * from <table> 
(though I've tried specifying the columns explicitly etc.)

Is this a bug, stupidity on my part or perhaps a jdbc driver bug (tried 
2 differet versions)?

btw I'm using PostgreSQL v8.0.8, jdbc-driver v8.0-317-jdbc3 if that 

Regards Chris

View raw message