| Summary: | @XmlValue and @XmlJoinNode conflict | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Jorge Arrieta <re.gmule+ebz> | ||||
| Component: | Eclipselink | Assignee: | Matt MacIvor <matt.macivor> | ||||
| Status: | RESOLVED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | matt.macivor | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Linux | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
forgot to mention that I'm using a package level @XmlAccessorType(XmlAccessType.FIELD) annotation, haven't really checked if this is at all relevant Created attachment 209142 [details]
proposed fix and test case (trunk)
Attached patch has been checked in to Trunk and 2.3.3. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
When trying to create a JAXB Context which contains the classes below: public class VOEntryType { @XmlJoinNode(referencedXmlPath = "@id_option", xmlPath = "@id") public Option key; @XmlValue public Integer value; } and public class Option { @XmlKey @XmlAttribute @XmlJavaTypeAdapter(IntegerToStringAdapter.class) private int id_option; ... I get the following exception: Exception [EclipseLink-50010] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.JAXBException Exception Description: The property or field key must be an attribute because another field or property is annotated with XmlValue. at org.eclipse.persistence.exceptions.JAXBException.propertyOrFieldShouldBeAnAttribute(JAXBException.java:233) Now, trying adding an attribute, like this (which, doesn't look right): @XmlAttribute @XmlJoinNode(referencedXmlPath = "@id_option", xmlPath = "@id") public Option key; Results in: java.lang.NullPointerException at org.eclipse.persistence.jaxb.compiler.SchemaGenerator.buildSchemaComponentsForXPath(SchemaGenerator.java:1018)