Target Object

As we require support beyond the JAXB spec, we will make use the EclipseLink extension @XmlCustomizer. Also since the relationship is bidirectional, we will use the EclipseLink extension @XmlInverseReference.

If we want the content of the EmployeeId class to be embedded in the complex type corresponding to the Employee class then we can change the XPath on the mapping for the "id" property to be self or ".".

Then we must specify the XPath to the XML nodes which represent the ID.

Source Object

If the target object had a single ID then we would use @XmlIDREF. Since the target object has a compound key, we will mark the field @XmlTransient, and use the EclipseLink extension @XmlCustomizer to set up the mapping.