Hey
Heiko Seebach wrote:
> Hi, I'm trying to use JBoss (newest CVS) with Oracle and I made a class
> "mypackage.category.beans.CategoryEntityBean".
<snip>
If you check the "Type mappings" in the JAWS configuration you will find
the Oracle mappings. Simply change the int mapping.
/Rickard
>
> public class CategoryEntityBean implements EntityBean {
> public Integer id;
> public String name = null;
> public String description = null;
> ...
> }
>
> In jaws.xml I defined a CMP-field like this:
> <cmp-field>
> <field-name>id</field-name>
> <column-name>id</column-name>
> <sql-type>INTEGER</sql-type>
> <jdbc-type>INTEGER</jdbc-type>
> </cmp-field>
>
> When I call
> CategoryEntity ce = categoryEntityHome.findByPrimaryKey(new Integer(42));
>
> I get the following error:
> [JAWS] Load SQL:SELECT id,description,name FROM category WHERE id=?
> at java.lang.reflect.Field.set(Native Method)
> at
> org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity(JAWSPersistence
> Manager.java:697)[Default] java.rmi.ServerException: Load failed; nested
> exception is:
> .
> .
> java.lang.IllegalArgumentException: argument type mismatch
> [Default] java.lang.IllegalArgumentException: argument type mismatch
>
> Then I put before line 697 "((Field)cmpFields.get(i)).set(ctx.getInstance(),
> rs.getObject(idx++));" in
> JAWSPersistenceManager:
>
> System.out.println("ctx.getInstance()="+ctx.getInstance());
> System.out.println("idx="+idx);
> System.out.println("rs.getObject(idx)="+rs.getObject(idx));
> System.out.println("rs.getObject(idx).getClass()="+rs.getObject(idx).getClas
> s());
> System.out.println("cmpFields.get(i)="+cmpFields.get(i));
>
> and it returned:
>
> [JAWS] Load SQL:SELECT id,description,name FROM category WHERE id=?
> [Default] ctx.getInstance()=CategoryEntityBean 0
> [Default] idx=1
> [Default] rs.getObject(idx)=42
> [Default] rs.getObject(idx).getClass()=class java.math.BigDecimal
> [Default] cmpFields.get(i)=public java.lang.Integer
> mypackage.category.beans.CategoryEntityBean.id
> at java.lang.reflect.Field.set(Native Method)
> at
> org.jboss.ejb.plugins.jaws.JAWSPersistenceManager.loadEntity(JAWSPersistence
> Manager.java:697)[Default] java.rmi.ServerException: Load failed; nested
> exception is:
> java.lang.IllegalArgumentException: argument type mismatch
> [Default] java.lang.IllegalArgumentException: argument type mismatch
>
> Surprise, surprise: why BigDecimal? Is this a problem with Oracles
> JDBC-driver or JAWS?
> It's working fine, when I call findAll(), but not when I call
> findByPrimaryKey(...)
>
> (
> Btw. when I change
> public Integer id;
> to
> public int id;
> I get the same error, except that
> [Default] cmpFields.get(i)=public java.lang.Integer
> mypackage.category.beans.CategoryEntityBean.id
> changes to
> [Default] cmpFields.get(i)=public int
> mypackage.category.beans.CategoryEntityBean.id
> )
>
> Keep up the good work!
> Heiko Seebach
>
> --
> Heiko Seebach WEB.DE AG
> Online Developer Amalienbadstr. 41
> Fon: +49 721 94329-857 D-76227 Karlsruhe
> Fax: +49 721 94329-22 Germany
> [EMAIL PROTECTED] http://web.de
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
--
Rickard �berg
@home: +46 13 177937
Email: [EMAIL PROTECTED]
http://www.telkel.com
http://www.jboss.org
http://www.dreambean.com
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]