Hello all,
I would like to map a class with an array type member. From the docu it is not clear to me if this is possible only for XML or for JDO as well.
The class:
public class test { private Integer id; private String[] myarray;
public test() {}
public Integer getId() { return this.id; }
public void setId(Integer id) { this.id = id; }
public String[] getMyarray() { return this.myarray; }
public void setMyarray(String[] myarray) { this.myarray = myarray; } }
The mapping file:
<mapping> <class name="test" identity="id" key-generator="MAX"> <map-to table="test"/> <field name="id" type="integer"> <sql name="ID" type="integer" /> </field> <field name="myarray" type="java.lang.String" collection="array"> <sql name="MYARRAY" type="char" /> </field> </class> </mapping>
Is the mapping correct? I played with the settings but get an exception when I retrieve stored values:
JDO queryException: org.exolab.castor.jdo.DataObjectAccessException: Type conver
sion error: could not set value of FieldMolder of test.setmyarray(java.lang.Stri
ng myarray) with value of type java.lang.String
org.exolab.castor.jdo.DataObjectAccessException: Type conversion error: could no
t set value of FieldMolder of test.setmyarray(java.lang.String myarray) with val
ue of type java.lang.String
at org.exolab.castor.persist.FieldMolder.setValue(FieldMolder.java:330)
at org.exolab.castor.persist.ClassMolder.load(ClassMolder.java:720)
at org.exolab.castor.persist.LockEngine.load(LockEngine.java:356)
at org.exolab.castor.persist.TransactionContext.load(TransactionContext.
java:649)
at org.exolab.castor.persist.QueryResults.fetch(QueryResults.java:229)
at org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.next(OQLQuer
yImpl.java:697)
at org.exolab.castor.jdo.engine.OQLQueryImpl$OQLEnumeration.next(OQLQuer
yImpl.java:670)
at jdotest.main(jdotest.java:44)
.. and this only if the table contains more than one row. Thanks for any help!
Andreas
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user