JBoss/JAWS Database Mappings for PosgreSQL7

The SQL database type mappings furnished as part of JBoss 2.4.3 (./conf/default/standardjaws.xml) do contain a section for PostgreSQL, but this seems to be for PostgreSQL 6.x. Here is an updated (additional) section for this file which works fine for me. I tested it with JBoss 2.4.3 and PostgreSQL 7.1r3 on Debian Potato.

Note

Recent releases of JBoss do contain support for PostgreSQL 7.x. This page is kept for reference. (2002-06-29)

Download

Download jaws-postgresql7.xml here (2002-01-11). Here's the interesting part:

<type-mapping>
        <name>PostgreSQL7</name>
        <mapping>
                <java-type>java.lang.Boolean</java-type>
                <jdbc-type>TINYINT</jdbc-type>
                <sql-type>BOOLEAN</sql-type>
        </mapping>
        <mapping>
                <java-type>java.lang.Byte</java-type>
                <jdbc-type>TINYINT</jdbc-type>
                <sql-type>SMALLINT</sql-type>
        </mapping>
        <mapping>
                <java-type>java.lang.Short</java-type>
                <jdbc-type>SMALLINT</jdbc-type>
                <sql-type>SMALLINT</sql-type>
        </mapping>
        <mapping>
                <java-type>java.lang.Integer</java-type>
                <jdbc-type>INTEGER</jdbc-type>
                <sql-type>INTEGER</sql-type>
        </mapping>
        <mapping>
                <java-type>java.lang.Long</java-type>
                <jdbc-type>BIGINT</jdbc-type>
                <sql-type>BIGINT</sql-type>
        </mapping>
        <mapping>
                <java-type>java.lang.Float</java-type>
                <jdbc-type>FLOAT</jdbc-type>
                <sql-type>REAL</sql-type>
        </mapping>
        <mapping>
                <java-type>java.lang.Double</java-type>
                <jdbc-type>DOUBLE</jdbc-type>
                <sql-type>DOUBLE PRECISION</sql-type>
        </mapping>
        <mapping>
                <java-type>java.lang.Character</java-type>
                <jdbc-type>CHAR</jdbc-type>
                <sql-type>CHAR(1)</sql-type>
                <!-- Alternative: "char", see PostgreSQL7 docs -->
        </mapping>
        <mapping>
                <java-type>java.lang.String</java-type>
                <jdbc-type>VARCHAR</jdbc-type>
                <sql-type>TEXT</sql-type>
        </mapping>
        <mapping>
                <java-type>java.sql.Date</java-type>
                <jdbc-type>DATE</jdbc-type>
                <sql-type>DATE</sql-type>
        </mapping>
        <mapping>
                <java-type>java.sql.Time</java-type>
                <jdbc-type>TIME</jdbc-type>
                <sql-type>TIME</sql-type>
        </mapping>
        <mapping>
                <java-type>java.sql.Timestamp</java-type>
                <jdbc-type>TIMESTAMP</jdbc-type>
                <sql-type>TIMESTAMP</sql-type>
        </mapping>
        <mapping>
                <java-type>java.lang.Object</java-type>
                <jdbc-type>JAVA_OBJECT</jdbc-type>
                <sql-type>OID</sql-type>
        </mapping>
</type-mapping>
Installation

To install, extract the <type-mapping> from the file and paste it into your standardjaws.xml. It is a good idea to do this in a non-default configuration. (But, hey, if you're coding the future, who am I to tell you this... :-)

Copyright

This code was written by me, Matthias Gärtner. It is freeware. Do with it whatever you want. Use at your own risk. No warranty of any kind.

Back to main page. Back to software page.


 
This page was last changed on April 1st, 2002. © Matthias Gärtner 2001