Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367803 - @XmlValue and @XmlJoinNode conflict
Summary: @XmlValue and @XmlJoinNode conflict
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Matt MacIvor CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-03 17:41 EST by Jorge Arrieta CLA
Modified: 2022-06-09 10:04 EDT (History)
1 user (show)

See Also:


Attachments
proposed fix and test case (trunk) (12.07 KB, patch)
2012-01-06 13:23 EST, Matt MacIvor CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jorge Arrieta CLA 2012-01-03 17:41:52 EST
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)
Comment 1 Jorge Arrieta CLA 2012-01-03 17:56:53 EST
forgot to mention that I'm using a package level @XmlAccessorType(XmlAccessType.FIELD) annotation, haven't really checked if this is at all relevant
Comment 2 Matt MacIvor CLA 2012-01-06 13:23:54 EST
Created attachment 209142 [details]
proposed fix and test case (trunk)
Comment 3 Matt MacIvor CLA 2012-01-25 09:31:44 EST
Attached patch has been checked in to Trunk and 2.3.3.
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:04:18 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink