Senario:
Class1 has a collection of Class2's.
Class2 knows whom its Class1 is.

Usage:
Marshaling Class2 to XML.

Description:
If I marshal Class2 to XML, I get a stack overflow error. I origonally 
thought this was because the XML bindings are also circular, since Class2 
would marshal Class1 to XML and Class1 would marshal Class2 to XML etc..
So I commented out (shown below) the XML binding from Class1's collection of 
Class2s. However I still got the stack overflow exception.
This was surprising (to me) as I was thinking, if there was no XML binding, 
then Class1 wouldn't attempt to marshal Class2 to XML, but it does!

I there anyway that I can marshal this kind of relationship to XML? the 
confusing thing is this relationship works fine for SQL mapping, just not 
XML.

<class name="Class1" identity="id">
    <map-to table="Class1" xml="Class1" />
    <field name="id" type="string" >
      <sql name="id" type="char"/>
      <xml name="id" node="attribute"/>
    </field>
    <field name="class2s" type="Class2" required="true"
           collection="collection">
      <sql many-key="class1Id"/>
      <!-- <xml name="quotes" node="element" /> -->
    </field>
</class>

<class name="Class2" identity="id">
    <map-to table="Class2" xml="Class2" />
    <field name="id" type="string">
      <sql name="id" type="char" />
      <xml name="id" node="attribute"/>
    </field>
    <field name="Class1" type="Class1">
      <sql name="class1Id" />
      <xml name="Class1" node="element"/>
    </field>
</class>


Thanks for any help!

p.s. I have written a patch (for Castor) so that I can do the above. However 
I'm thinking that Castor probably does what I want and I'm just doing 
something wrong.

_________________________________________________________________
Join the world�s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com

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

Reply via email to