Hi there.
I found out that for setting the 4th parameter Castor JDO issues this call:
PreparedStatement.setObject(4, new java.math.BigDecimal("3"),
java.sql.Types.NUMERIC). The Tamino SQL driver does not allow this for an
INTEGER typed field.
Why does Castor do so? In the mapping, there is no type mentioned for the
group_id field. Instead, the group_id is typed in the object ProductGroup.
According to the documentation, Castor should cast a java.lang.Integer to a
SQL INTEGER type. However, it uses a BigDecimal on the JDBC layer.
Can anyone comment on this?
Hiran
----------------------------------------------------taken from
mapping.xml----------
<class name="myapp.ProductGroup" identity="id">
......
<field name="id" type="integer" >
<sql name="id" type="integer"/>
<bind-xml node="attribute"/>
</field>
.....
</class>
<class name="myapp.Product" identity="id">
....
<field name="group" type="myapp.ProductGroup">
<sql name="group_id"/>
<bind-xml name="group" node="element" />
</field>
.....
</class>
----------------------------------------------------------------------------
-----------
----- Original Message -----
From: "Hiran Chaudhuri" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 04, 2003 9:02 AM
Subject: [castor-dev] Problem running sample
> Hi there.
>
> Can someone give me a hint what's wrong running the castor sample?
> - In database.xml I entered driver and connection information for my
Tamino
> SQL Engine.
> - In create.sql I adapted the SQL statements so my database will create
the
> tables the way castor expects it.
> - In mapping.xml I actually tried not to change anything, but....
>
> As Tamino SQL does not know about a numeric data type, I changed that to
> float/decimal/whatever. From JDBC the data type is mentioned as DOUBLE.
> However I keep getting the listed error message, and suspect that it
occurs
> with the price field. If it is the group_id, what can I do to overcome
that
> error?
>
> Hiran
>
> [test] Creating new product: <id: 4 name: product4>
> [test] Castor: Creating myapp.Product (4)
> [test] Error creating myapp.Product, SQL : INSERT INTO "prod"
> ("id","name","price","group_id") VALUES (?,?,?,?)
> [test] org.exolab.castor.jdo.PersistenceException: Nested error:
> java.sql.SQLException: setDouble() is wrong Method to set inputparameter 4
> [test] java.sql.SQLException: setDouble() is wrong Method to set
> inputparameter 4
> [test] at
> de.sag.jdbc.tsql.server.AInputServer.checkType(AInputServer.java:930)
> [test] at
> de.sag.jdbc.tsql.server.AInputServer.setDouble(AInputServer.java:345)
> [test] at
> de.sag.jdbc.tsql.server.AInputServer.setBigDecimal(AInputServer.java:351)
> [test] at
> de.sag.jdbc.tsql.server.AInputServer.setObject(AInputServer.java:723)
> [test] at
> de.sag.jdbc.tsql.APreparedStatement.setObject(APreparedStatement.java:665)
> [test] at
> de.sag.jdbc.tsql.APreparedStatement.setObject(APreparedStatement.java:674)
> [test] at
> org.exolab.castor.jdo.engine.SQLTypes.setObject(SQLTypes.java:420)
> [test] at
org.exolab.castor.jdo.engine.SQLEngine.create(SQLEngine.java:598)
> [test] at
> org.exolab.castor.persist.ClassMolder.create(ClassMolder.java:903)
> [test] at
org.exolab.castor.persist.LockEngine.create(LockEngine.java:458)
> [test] at
>
org.exolab.castor.persist.TransactionContext.create(TransactionContext.java:
> 883)
> [test] at
> org.exolab.castor.jdo.engine.DatabaseImpl.create(DatabaseImpl.java:366)
> [test] at castorjdo.Test.run(Test.java:222)
> [test] at castorjdo.Test.main(Test.java:63)
>