Hi,

I have written my own mapping program to test the mapping from Oracle
JDBCDriver and with this program the same message was thrown as with jBoss
Default CMP EntityBean Container.
The datatype that I get back from the JDBCDriver is java.math.BigDecimal and
the datatype in Oracle is NUMBER(6,0), and so the Exception
java.lang.IllegalArgumentException was thrown.
Oracle do not have a datatype Integer if you use it, oracle would generate a
NUMBER field and the default mapping of type NUMBER/NUMERIC is
java.math.BeigDecimal ...

Any ideas ?

Here my small test program:

--------- pgm code begin ---
package ib;

import java.sql.*;


public class GetMetaData {
  public int test;
  private Connection con;
  private Statement stmt;

  public static void main(String[] args) {
    GetMetaData getMetaData = new GetMetaData();
  }

  public GetMetaData() {

    java.lang.reflect.Field[] fields = this.getClass().getFields();
    try {
      Driver d = (Driver)(Class.forName(
"oracle.jdbc.driver.OracleDriver" ).newInstance());
   con =
DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:OBLDB","jboss"
, "jboss");
      stmt = con.createStatement();
      ResultSet rs = stmt.executeQuery("SELECT * from adresseeb");
      rs.next();
      ResultSetMetaData rsm = rs.getMetaData();

      System.out.println("Meta Informationen fuer Tabelle: " +
rsm.getSchemaName(1) + "." + rsm.getTableName(1));

      java.util.Map mm = new java.util.HashMap();
      mm.put("INTEGER", Class.forName("java.lang.Integer"));
      mm.put("NUMERIC", Class.forName("java.lang.Integer"));
      mm.put("NUMBER", Class.forName("java.lang.Integer"));

      Object val = rs.getObject(1, mm);
      fields[0].set(this, val);   // First Column is of Oracletype
NUMBER(6,0)
      for(int i=0;i<rsm.getColumnCount();i++) {
        System.out.println(rsm.getColumnName(i+1)+

":"+rsm.getColumnTypeName(i+1)+":"+rsm.getPrecision(i+1)+":"+rsm.getScale(i+
1)+
            "::"+rsm.getColumnClassName(i+1));
      }
    } catch(Exception e) {
      System.err.println(e);
    }

    System.exit(0);
  }
}
----- pgm code end ---

Ingo Bruell

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


Reply via email to