3 Replies Latest reply on Apr 16, 2003 3:17 AM by d3tommy

    CMP and java.util.Calendar

    d3tommy

      Hi,

      Is there any way to map a java.util.Calendar object to a sql TIMESTAMP. I'm using JBoss 3.2 and postgresql.

        • 1. Re: CMP and java.util.Calendar
          raja05

          Im not sure if this could be done, I may be wrong but as far as i can see, the types in standardjbosscmp-jdbc.xml map to valid java.sql.Types and there is no type for Calendar defined in java.sql.Types.

          you may have to convert ur Calendar to date somewhere!

          • 2. Re: CMP and java.util.Calendar
            pdelgado0


            I'm using Jboss 3.2 with Postgres 7.3.1 and in the file jbosscmp-jdbc.xml I put the following and it works with no problem.

            .....
            .....
            <cmp-field>
            <field-name>initdate</field-name>
            <column-name>initdate</column-name>
            <jdbc-type>DATE</jdbc-type>
            <sql-type>timestamp without time zone</sql-type>
            </cmp-field>
            .....
            .....


            Remember that the <jdbc-type> has to be a "java.sql.Types" so Calendar couln't be.

            http://stein.cshl.org/jade/distrib/docs/java.sql.Types.html

            Good luck.

            Pablo




            • 3. Re: CMP and java.util.Calendar
              d3tommy

              If I understand you correctlly there is no way to mapp a postgrsql type TIMESTAMP (with timezone) to a java class that handels both the timestamp and the timezone information (I can't find any in java.sql.TYPES).

              If this is the case, does it exist some pattern or "workaround" to get this done anyway.