i'm using a parent child relationship of the same object type:

public class Region {
String name;
Collection children;
Region parent;
// omitting the getter and setter methodss
}

lets say i have a tree structure like this:

Europe
|--Germany
|...|--Bayern
|--Austria
|......|--Salzburg
|.........|--North
|.........|--South
|--Italy

and i want to marshal and unmarshal only Austria with exactly on level of parents and one level of children:

Europe
Austria
Salzburg

when i use a mapping xml like this:
<?xml version="1.0" encoding="UTF-8"?>
<mapping xmlns="http://castor.exolab.org/";
xmlns:cst="http://castor.exolab.org/";>
<description>Castor generated mapping file</description>
<class cst:name="Region"
cst:auto-complete="false">
<description>Default mapping for class Region</description>
<map-to cst:xml="region"/>
<field cst:name="name" cst:type="java.lang.String">
<bind-xml name="name" node="element"/>
</field>
<field cst:name="children" cst:transient="false"
cst:type="Region"
cst:collection="collection">
<bind-xml name="children" node="element">
<class cst:name="Region"
cst:auto-complete="false">
<description>Children mapping for class Region</description>
<map-to cst:xml="region"/>
<field cst:name="name" cst:type="java.lang.String">
<bind-xml name="name" node="element"/>
</field>
<field cst:name="children" cst:transient="true" />
<field cst:name="parent" cst:transient="true"/>
</class>
</bind-xml>
</field>
<field cst:name="kunden" cst:transient="true" />
<field cst:name="benutzer" cst:transient="true"/>
<field cst:name="parent" cst:transient="false">
cst:type="Region">
<bind-xml name="parent" node="element">
<class cst:name="Region"
cst:auto-complete="false">
<description>Parent mapping for class Region</description>
<map-to cst:xml="region"/>
<field cst:name="name" cst:type="java.lang.String">
<bind-xml name="name" node="element"/>
</field>
<field cst:name="children" cst:transient="true" />
<field cst:name="parent" cst:transient="true"/>
</class>
</bind-xml>
</field>
</class>
</mapping>

and when i try to use this mapping i get:
java.lang.StackOverflowError

What am i doing wrong?
.. or is this a bug?



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

Reply via email to