Hi :)

 Let's have two principal java classes with javabeans-style getters and
setters :
1- public class A
{
private B car;
private C tool;
private D house;
}
and
2- public class B
{
private A owner;
}

Xml will be :
<person>
 <car>
   <owner>
     <car>...</car>
     <tool>...</tool>
     <house>...</house>
   </owner>
 </car>
 <tool>...</tool>
 <house>...</house>
</person>

Is it possible to have a mapping file which leads to
<person>
 <car>
   <owner>
     <house>...</house>
   </owner>
 </car>
 <tool>...</tool>
 <house>...</house>
</person>

For example, does the following mapping file work ?
<mapping>
 <class name="A" auto-complete="false" verify-constructable="false">
   <map-to xml="person"/>
   <field name="car" type="B">
     <bind-xml name="car" node="element"/>
   </field>
   <field name="tool" type="C">
     <bind-xml name="tool" node="element"/>
   </field>
   <field name="house" type="D" container="true">
     <bind-xml name="house" node="element"/>
   </field>
 </class>
 <class name="B" auto-complete="false" verify-constructable="false">
   <map-to xml="car"/>
   <field name="owner" type="A">
     <bind-xml name="owner" node="element">
       <class name="A" auto-complete="false" verify-constructable="false">
         <map-to xml="owner"/>
         <field name="house" type="D">
           <bind-xml name="house" node="element"/>
         </field>
       </class>
     </bind-xml>
   </field>
 </class>
</mapping>
If not, could someone teach me how to do ?

Thanks in advance for your help
Ticker

Reply via email to