JAXB Pass through mapping

Given the following classes:\[code\]@XmlRootElement(name = "parent")class Parent { private Child child; // What annotation goes here public Child getChild() { return child; } public void setChild(Child child) { this.child = child; }}class Child { private Integer age; @XmlElement(name = "age") public Integer getAge() { return age; } public void setAge(Integer Age) { this.age = age; }}\[/code\]What annotation do I need to add (where the comment is) to get the following xml:\[code\]<parent> <age>55</age> </parent>\[/code\]I just made the specific example off the top of my head so having the tag appear where it is probably doesn't make sense. But what I really want to know is how to do a pass-through to the Child class. Essentially its easy to do the mapping for the following (which I DON'T want):\[code\]<parent> <child> <age>55</age> </child> </parent>\[/code\]
 
Back
Top