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

Bug 316496

Summary: JAXB Externalized Metadata: Schema gen incorrect when composite is mapped to subclass of transient superclass
Product: z_Archived Reporter: David McCann <david.mccann>
Component: EclipselinkAssignee: Matt MacIvor <matt.macivor>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: matt.macivor
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed fix and updated tests none

Description David McCann CLA 2010-06-10 13:20:51 EDT
If Employee has a composite mapping to CDNAddress, which extends Address which is marked transient, the following schema components are generated for CDNAddress:

<xsd:complexType name="cdnAddress">
  <xsd:complexContent>
    <xsd:extension base="address">
      <xsd:sequence>
        <xsd:element name="street" type="xsd:string" minOccurs="0"/>
        <xsd:element name="city" type="xsd:string" minOccurs="0"/>
        <xsd:element name="country" type="xsd:string" minOccurs="0"/>
        <xsd:element name="prov" type="xsd:string" minOccurs="0"/>
        <xsd:element name="postal" type="xsd:string" minOccurs="0"/>
      </xsd:sequence>
    </xsd:extension>
  </xsd:complexContent>
</xsd:complexType>

Since Address is transient, it is not mapped to XML directly, but it's properties are to be mapped to a given subclass as if it were inlined.  So we would expect to get:

<xsd:complexType name="cdnAddress">
  <xsd:sequence>
    <xsd:element name="street" type="xsd:string" minOccurs="0"/>
    <xsd:element name="city" type="xsd:string" minOccurs="0"/>
    <xsd:element name="country" type="xsd:string" minOccurs="0"/>
    <xsd:element name="prov" type="xsd:string" minOccurs="0"/>
    <xsd:element name="postal" type="xsd:string" minOccurs="0"/>
  </xsd:sequence>
</xsd:complexType>

=================================================
Model:

public class Employee {
    public CDNAddress address;
}

public class Address {
    public String street;
    public String city;
    public String country;
}

public class CDNAddress extends Address {
    public String prov;
    public String postal;
}
Comment 1 Matt MacIvor CLA 2010-06-11 15:53:37 EDT
Created attachment 171763 [details]
proposed fix and updated tests
Comment 2 Matt MacIvor CLA 2010-06-14 13:17:16 EDT
Fix checked into trunk stream.
Leaving open pending check in to 2.1 stream.
Comment 3 Matt MacIvor CLA 2010-06-30 09:19:17 EDT
Fix Checked in to 2.1 stream
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:09:35 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink