Guys,
May be someone already has experience to bind a parent property on
'many'-side of one-to-many relationship and having castor to set this parent
property while unmarshalling object. Here's a small java code and xml
snippets explaining what I want to achieve.
<?xml version="1.0?>
<Cars>
<Car manufacturer="ford">
<Wheel radius="14" width="35"/>
<Wheel radius="14" width="40"/>
</Car>
<Car manufacturer="opel">
<Wheel radius="13" width="30"/>
<Wheel radius="13" width="35"/>
</Car>
<Cars>
public class Car implements Serializable {
private String manufacturer;
private List<Wheel> wheels = new ArrayList<Wheel>();
}
public class Wheel implements Serializable {
private String radius;
private String width;
private Car parent;
}
Of course, all class fields have corresponding getters and setters. May
there's any way to configure castor to set the 'parent' property on each
Wheel object with the Car object it belongs as stayted in xml? I know that I
can set the 'parent' property manually after unmarchalling, but I'd like
castor to do it automatically.
Thanks,
Max