Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 345645

Summary: [Validation] @XmlID validation
Product: [WebTools] Dali JPA Tools Reporter: Nan Li <nan.n.li>
Component: JAXBAssignee: Paul Fullbright <paul.fullbright>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: neil.hauge, paul.fullbright
Version: unspecifiedKeywords: plan
Target Milestone: 3.1 M3   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Nan Li CLA 2011-05-12 14:50:53 EDT
Build Identifier: I20110428-0848

The following mapping constraints must be enforced for XmlID type mapping:

• At most one field or property in a class can be annotated with @XmlID. We have a validation for this, but the validation stops working when @XmlAnyElement applies, e.g. there are two fields or properties in a class are annotated with @XmlID one of which is annotated with @XmlAnyElemnet.

• The only other program annotations allowed with @XmlID are @XmlAttribute and @XmlElement. We allow a class to be annotated with annotations other than @XmlAttribute and @XmlElement. 

Reproducible: Always
Comment 1 Paul Fullbright CLA 2011-06-03 17:45:31 EDT
Note that once @XmlAnyElement is present on a java attribute, we ignore @XmlID.  The validation should be a higher level "this annotation and that annotation don't work together", and probably should be a different bug.


From the JAXB 2.2 spec (8.9.11.2)

- At most one field or property in a class can be annotated with @XmlID. [ Done, see above]
- The type of the field or property must be java.lang.String.
- The only other program annotations allowed with @XmlID are:
@XmlAttribute and @XmlElement.  [ See above ]

Also:
- The schema type must be mapped to xs:ID.
Comment 2 Paul Fullbright CLA 2011-10-26 13:08:09 EDT
Added for 3.1 M3.