Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 345645 - [Validation] @XmlID validation
Summary: [Validation] @XmlID validation
Status: RESOLVED FIXED
Alias: None
Product: Dali JPA Tools
Classification: WebTools
Component: JAXB (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: 3.1 M3   Edit
Assignee: Paul Fullbright CLA
QA Contact:
URL:
Whiteboard:
Keywords: plan
Depends on:
Blocks:
 
Reported: 2011-05-12 14:50 EDT by Nan Li CLA
Modified: 2011-10-31 11:01 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.