Community
Participate
Working Groups
From the JAXB 2.2 spec (8.9.3.2) - The only other additional JAXB mapping annotations allowed with @XmlElementRef are: @XmlElementWrapper and @XmlJavaTypeAdapter. - If the collection item type or property type (for single valued property) is javax.xml.bind.JAXBElement, then {@XmlElementRef.name(),@XmlElementRef.namespace() } must point an element factory method with an @XmlElementDecl annotation in a class annotated with @XmlRegistry (usually ObjectFactory class generated by the schema compiler) : a. @XmlElementDecl.name() must equal @XmlElementRef.name() b. @XmlElementDecl.namespace() must equal @XmlElementRef.namespace(). - If the collection item type (for collection property) or property type (for single valued property) is not javax.xml.bind.JAXBElement, then the type referenced by the property or field must be annotated with @XmlRootElement Content assist is needed for name and namespace.
Correction from: - If the collection item type (for collection property) or property type (for single valued property) is not javax.xml.bind.JAXBElement, then the type referenced by the property or field must be annotated with @XmlRootElement to: - If the collection item type (for collection property) or property type (for single valued property) is not javax.xml.bind.JAXBElement, then the type referenced by the property or field must have a type *in its hierarchy* annotated with @XmlRootElement Completed for M2