JAXB XmlID and XmlIDREF annotations (Schema to Java)
- by kipz
I am exposing a web service using CXF. I am using the @XmlID and @XmlIDREF JAXB annotations to maintain referential integrity of my object graph during marshalling/unmarshalling.
The WSDL rightly contains elements with the xs:id and xs:idref attributes to represent this.
On the server side, everything works really nicely. Instances of Types annotated with @XmlIDREF are the same instances (as in ==) to those annotated with the @XmlID annotation.
However, when I generate a client with WSDLToJava, the references (those annotated with @XmlIDREF) are of type java.lang.Object.
Is there any way that I can customise the JAXB bindings such that the types of references are either java.lang.String (to match the ID of the referenced type) or the same as the referenced type itself?