Andreas,

can I assume that you want to store the strings stored in the array in a separate 
table ? If so, can I please see the DDL you are using to create those 
tables ?

Regards
Werner

On Fri, 05 Nov 2004 08:50:22 +0100, Andreas Vombach wrote:

>
>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
>



----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-user

Reply via email to