EclipseLink 2.5.0, build 'v20130425-368d603' API Reference

org.eclipse.persistence.oxm.annotations
Annotation Type XmlInverseReference


@Target(value={FIELD,METHOD})
@Retention(value=RUNTIME)
public @interface XmlInverseReference

This annotation is used to map a back-pointer during the unmarshal operation. When configuring an @XmlInverseReference, the "mappedBy" attribute must be set to the field on the reference class that maps to this field. For example:

 @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;
    ...
 }


Required Element Summary
 java.lang.String mappedBy
           
 

Element Detail

mappedBy

public abstract java.lang.String mappedBy

EclipseLink 2.5.0, build 'v20130425-368d603' API Reference