@Target(value={FIELD,METHOD})
@Retention(value=RUNTIME)
public @interface XmlInverseReference
@XmlRootElement
public class Employee {
...
@XmlElementWrapper(name="phone-numbers")
@XmlElement(name="number")
public List<PhoneNumber> phoneNumbers;
...
}
public class PhoneNumber {
...
@XmlInverseReference(mappedBy="phoneNumbers")
public Employee owningEmployee;
...
}
By default using @XmlInverseReference will make the property act the same as @XmlTransient for the marshal operation. You can make the property writeable by combining it will @XmlElement.
public class PhoneNumber {
...
@XmlInverseReference(mappedBy="phoneNumbers")
@XmlElement
public Employee owningEmployee;
...
}
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
mappedBy |