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

Bug 316465

Summary: JAXB Externalized Metadata: Schema gen incorrect when setting XPath via XmlPath annotation
Product: z_Archived Reporter: David McCann <david.mccann>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Contains fix + test case mods for 2.2 stream
none
Contains fix + test case mods none

Description David McCann CLA 2010-06-10 10:08:34 EDT
The XPath set on the XmlPath annotation is not set properly such that schema generation will work properly.  For example, if the following was set:

  @XmlAttribute
  @XmlPath("@id")
  public int empId;

we would expect the following to be generated:

  <xsd:attribute name="id" type="xsd:int" use="required"/>

but instead we get:

  <xsd:attribute name="empId" type="xsd:int" use="required"/>

The fix should be done in AnnotationsProcessor.buildNewProperty():  we need to set the schemaName property on Property, as this value is used for the schema component name during schema generation.
Comment 1 David McCann CLA 2010-06-15 11:52:02 EDT
Required in:

  2.1
  2.2
Comment 2 David McCann CLA 2010-06-15 11:53:42 EDT
Created attachment 171958 [details]
Contains fix + test case mods for 2.2 stream
Comment 3 David McCann CLA 2010-07-09 09:51:26 EDT
Created attachment 173858 [details]
Contains fix + test case mods
Comment 4 David McCann CLA 2010-07-09 10:34:07 EDT
Fix checked into the 2.1 stream.  Now both 2.2 and 2.1 contain this fix.

Reviewed by:  matt.macivor@oracle.com
Tests: all unit tests pass as expected; jaxb/externalizedmetadata/mappings/direct/DirectMappingTestCases
Comment 5 Eclipse Webmaster CLA 2022-06-09 10:30:44 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink