Timestamps not working for me in PostgreSQL 8.0

From: Chris Poulsen (mailinglis..esluop.dk)
Date: Thu Sep 21 2006 - 18:16:04 EDT

  • Next message: Andrus Adamchik: "Re: Timestamps not working for me in PostgreSQL 8.0"

    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
    matters.

    -- 
    Regards Chris
    



    This archive was generated by hypermail 2.0.0 : Thu Sep 21 2006 - 18:16:17 EDT