I'm using castor 0.9.4.3
I have 2 classes User and View, with the many to many realationship
User <- viewers ------ view -> View

I use an ArrayLists of handles to manage the relationship in the 2 classes

I did the following mapping:

  <class name="it.wblweb.enterprise.View" identity="id">
    <map-to xml="view"/>
    <field name="id" type="java.lang.String">
      <bind-xml name="id" node="attribute" required="true"/>
    </field>
    <field name="viewers" type="it.wblweb.enterprise.User"
collection="arraylist">
      <bind-xml name="viewers" reference="true" node="attribute"/>
    </field>
  </class>

  <class name="it.wblweb.enterprise.User" identity="id" >
    <map-to xml="user"/>
    <field name="id" type="java.lang.String">
      <bind-xml name="id" node="attribute" required="true"/>
    </field>
    <field name="defaultView" type="it.wblweb.enterprise.View">
      <bind-xml name="defaultView" node="attribute" reference="true"/>
    </field>
  </class>

and the marshalling works fine:

<?xml version="1.0" encoding="UTF-8"?>
<storage>
    <item id="alagna" views="v1 v2" xsi:type="user"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
    <item id="v2" xsi:type="view"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
    <item id="v1" xsi:type="view"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
</storage>

But if I unmarshal the above XML, the ArrayList views of User is filled up
with the string "v1 v2" instead of the handles to v1 and v2 and the
ArrayList viewers of View is filled up with the string "alagna" instead of
the handle to the alagna User.

Where's the mistake?
Please let me know
ciao and many thanks in advance

Alberto Lagna

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

Reply via email to