Hi,

> Change the "TimeStamp" in jaws.xml to "Timestamp" and the
> TIMESTAMP columns should work OK - assuming, of course, that TIMESTAMP is

OK.

> a valid SQL type for DB2/400.  I'll double-check the other contributed
> mappings - I had to correct that typo for several myself.  Weird that it
> had problems on the min/max tests for Integers and Bytes - that's the
> first time I've ever seen it fail for Integer.  Can you confirm that the
> int field is getting written to the DB?

All fields were written, but I have changed the type-mapping of Integer. Now
Long and Integer have the same size.
And the tests work.

> Can you also note the DB OS and hardware you used?  I assume it
> has something to do with AS400, but I know next to nothing about that
> platform...

Hardware: AS400 Model 170
OS: OS/400 V4R3M0 (RISC)

> DB2 doesn't seem to support variables of type "byte" (they have to
> be serialized), so it doesn't surprise me that DB2/400 doesn't either.  If
> you comment out the byte mapping in jaws.xml (thereby forcing bytes to be
> serialized) and update the TimeStamp one to read Timestamp, can you then
> run the dbtest successfully without altering the ejb-jar.xml file?

OK Changed.

Result:

---- snip ----
E:\Develop\cvs\jbosstest\dist\bin>java -classpath ../lib/dbtestclient.jar
org.jb
oss.test.dbtest.test.Main
_____________________________________________

jBoss, the EJB Open Source Server
Copyright (C), The jBoss Organization, 2000
_____________________________________________

Welcome to the database test
_____________________________________________

Deploying the bean...done!

1- Looking up the home AllTypes...OK
2- Calling findByPrimaryKey on AllTypesHome with name seb...Object with
primary
key seb not found in storage
not found OK
3- Calling create on AllTypesHome with name seb...OK
Getting all the fields
4- boolean true OK
5- byte 1 OK
6- short 2 OK
7- int 3 OK
8- long 4 OK
9- float 5.6 OK
10- double 7.8 OK
No char test yet, bug in jdk
11- String seb OK
12- Date Tue Oct 24 10:14:22 GMT+02:00 2000 OK
13- Time 10:14:22 OK
14- Timestamp 2000-10-24 10:14:22.665 OK
15- MyObject OK
16- Creating Record beans and adding them to the Collection in Alltypes..OK
17- Getting them back..OK
All basic tests passed; Now testing min/max values.
This is just for information, it's okay if some fail.
Not all DBs have a column type that supports 8-byte numbers.
18- Double Min Value OK
19- Double Max Value OK
20- Float Min Value OK
21- Float Max Value OK
22- Long Min Value OK
23- Long Max Value OK
24- Short Min Value OK
25- Short Max Value OK
26- Byte Min Value OK
27- Byte Max Value OK
28- Int Min Value OK
29- Int Max Value OK

_____________________________________________
Congratulations!  Test completed
Please report success to the mailing list:
   [EMAIL PROTECTED]

Don't forget to mention:
   OS                      : Windows 2000
   JDK vendor/version      : JDK1.3

   jBoss version           : jBoss 2.0 BETA-PROD-PRE-03

   Database name/version   : DB2/400 V4R3M0
   JDBC driver version     : jt400 V4R2M0.6

And please include:
   Your setup: relevant parts of jboss.properties, jboss.conf and jboss.jcml
   The type-mappings from jaws.xml if you changed them

Thanks very much!
---- snap ----

ejb-jar.xml:

---- snip ----
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise
JavaBeans 1.1//EN" "http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd">

<ejb-jar>
    <enterprise-beans>

        <entity>
            <ejb-name>AllTypes</ejb-name>
            <home>org.jboss.test.dbtest.interfaces.AllTypesHome</home>
            <remote>org.jboss.test.dbtest.interfaces.AllTypes</remote>
            <ejb-class>org.jboss.test.dbtest.bean.AllTypesBean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>java.lang.String</prim-key-class>
   <primkey-field>aString</primkey-field>

   <reentrant>False</reentrant>

   <cmp-field>
                <field-name>aBoolean</field-name>
            </cmp-field>

   <cmp-field>
                <field-name>aByte</field-name>
            </cmp-field>

   <cmp-field>
                <field-name>aShort</field-name>
            </cmp-field>

   <cmp-field>
                <field-name>anInt</field-name>
            </cmp-field>

   <cmp-field>
                <field-name>aLong</field-name>
            </cmp-field>

   <cmp-field>
                <field-name>aFloat</field-name>
            </cmp-field>

   <cmp-field>
                <field-name>aDouble</field-name>
            </cmp-field>
<!-- <fucked up>
   <cmp-field>
                <field-name>aChar</field-name>
            </cmp-field>
-->
   <cmp-field>
                <field-name>aString</field-name>
            </cmp-field>

   <cmp-field>
                <field-name>aDate</field-name>
            </cmp-field>

   <cmp-field>
                <field-name>aTime</field-name>
            </cmp-field>
   <cmp-field>
                <field-name>aTimestamp</field-name>
            </cmp-field>
   <cmp-field>
                <field-name>anObject</field-name>
            </cmp-field>

   <cmp-field>
                <field-name>aList</field-name>
            </cmp-field>
        </entity>

  <entity>
            <ejb-name>Record</ejb-name>
            <home>org.jboss.test.dbtest.interfaces.RecordHome</home>
            <remote>org.jboss.test.dbtest.interfaces.Record</remote>
            <ejb-class>org.jboss.test.dbtest.bean.RecordBean</ejb-class>
            <persistence-type>Container</persistence-type>
            <prim-key-class>java.lang.String</prim-key-class>
   <primkey-field>name</primkey-field>

   <reentrant>False</reentrant>

   <cmp-field>
                <field-name>name</field-name>
            </cmp-field>

   <cmp-field>
                <field-name>address</field-name>
            </cmp-field>
        </entity>

    </enterprise-beans>
    <assembly-descriptor>
        <container-transaction>
            <method>
                <ejb-name>AllTypes</ejb-name>
                <method-name>*</method-name>
            </method>
            <trans-attribute>Required</trans-attribute>
        </container-transaction>
    </assembly-descriptor>
</ejb-jar>
---- snap ----

jaws.xml:

---- snip ----
<?xml version="1.0" encoding="UTF-8"?>
<jaws>

    <!--  Replace this with the name of your connection pool (from
jboss.conf) -->
    <datasource>AS400Pool</datasource>

 <!--  Replace this with the type-mapping you want to use (choose one
below) -->
 <type-mapping>DB2/400</type-mapping>
 <default-entity>
  <remove-table>false</remove-table>
 </default-entity>
    <type-mappings>
        <type-mapping>
          <name>DB2/400</name>
          <mapping>
              <java-type>java.lang.Character</java-type>
              <jdbc-type>CHAR</jdbc-type>
              <sql-type>CHAR(1)</sql-type>
          </mapping>
          <mapping>
              <java-type>java.lang.String</java-type>
              <jdbc-type>VARCHAR</jdbc-type>
              <sql-type>VARCHAR(256)</sql-type>
          </mapping>
<!--
          <mapping>
              <java-type>java.lang.Byte</java-type>
              <jdbc-type>CHAR</jdbc-type>
              <sql-type>CHAR(1) FOR BIT DATA</sql-type>
          </mapping>
-->
          <mapping>
              <java-type>java.util.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.lang.Float</java-type>
              <jdbc-type>FLOAT</jdbc-type>
              <sql-type>FLOAT</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.Double</java-type>
              <jdbc-type>DOUBLE</jdbc-type>
              <sql-type>DOUBLE</sql-type>
          </mapping>
          <mapping>
              <java-type>java.lang.Long</java-type>
              <jdbc-type>BIGINT</jdbc-type>
              <sql-type>INTEGER</sql-type>
          </mapping>
          <mapping>
              <java-type>java.lang.Boolean</java-type>
              <jdbc-type>CHAR</jdbc-type>
              <sql-type>CHAR(5)</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.Object</java-type>
              <jdbc-type>JAVA_OBJECT</jdbc-type>
              <sql-type>VARCHAR(4096) for BIT DATA</sql-type>
          </mapping>
          <mapping>
              <java-type>java.sql.Timestamp</java-type>
              <jdbc-type>TIMESTAMP</jdbc-type>
              <sql-type>TIMESTAMP</sql-type>
          </mapping>
        </type-mapping>
    </type-mappings>
</jaws>
---- snap ----

CU

---
Ingo Bruell
OBL GmbH ([EMAIL PROTECTED])
Hude (Oldenburg)
Germany



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Problems?:           [EMAIL PROTECTED]

Reply via email to