JAXB XmlID and XmlIDREF annotations (Schema to Java)

Posted by kipz on Stack Overflow See other posts from Stack Overflow or by kipz
Published on 2009-01-13T16:18:35Z Indexed on 2010/04/13 7:12 UTC
Read the original article Hit count: 717

Filed under:
|
|
|
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about jaxb