Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 340223 - Use of XmlJoinNode should not require accompanying XmlID annotation
Summary: Use of XmlJoinNode should not require accompanying XmlID annotation
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-16 15:00 EDT by Rick Barkhouse CLA
Modified: 2022-06-09 10:27 EDT (History)
1 user (show)

See Also:


Attachments
proposed fix and modified test (5.60 KB, patch)
2011-05-13 12:26 EDT, 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 Rick Barkhouse CLA 2011-03-16 15:00:44 EDT
When trying to create a JAXB Context using the class below:

public class Employee {
    @XmlID
    @XmlAttribute
    public Integer id;

    @XmlKey
    @XmlAttribute
    public String name;

    @XmlJoinNodes( {
            @XmlJoinNode(xmlPath = "manager/@id", referencedXmlPath = "@id"),
            @XmlJoinNode(xmlPath = "manager/@name", referencedXmlPath = "@name") })
    public Employee manager;

    @XmlJoinNodes( {
        @XmlJoinNode(xmlPath = "report/@id", referencedXmlPath = "@id"),
        @XmlJoinNode(xmlPath = "report/@name", referencedXmlPath = "@name") })
    public List<Employee> reports = new ArrayList<Employee>();
}

EclipseLink throws the following exception:

Exception Description: Property [manager] in class [documentation.Employee] has an XmlJoinNode declaration with referencedXmlPath [@id], but there is no XmlID or XmlKey property on the target class [documentation.Employee] with the XmlPath [@id].  It is required that there is an XmlID/XmlKey property with a matching XmlPath on the target class for each referencedXmlPath.

Adding a redundant @XmlPath annotation solves the problem but the user should not be forced to do this, because the XPath is implied by using @XmlAttribute.
Comment 1 Rick Barkhouse CLA 2011-03-16 16:01:11 EDT
This problem exists when using both annotations and OXM.
Comment 2 Rick Barkhouse CLA 2011-03-16 16:02:30 EDT
Correction: This problem exists when using *either* annotations or OXM.
Comment 3 Matt MacIvor CLA 2011-05-13 12:26:48 EDT
Created attachment 195606 [details]
proposed fix and modified test
Comment 4 Matt MacIvor CLA 2011-05-13 14:00:15 EDT
Attached patch checked in to SVN
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:16:23 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:27:58 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink