Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316496 - JAXB Externalized Metadata: Schema gen incorrect when composite is mapped to subclass of transient superclass
Summary: JAXB Externalized Metadata: Schema gen incorrect when composite is mapped to ...
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: Matt MacIvor CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-10 13:20 EDT by David McCann CLA
Modified: 2022-06-09 10:09 EDT (History)
1 user (show)

See Also:


Attachments
proposed fix and updated tests (6.10 KB, patch)
2010-06-11 15:53 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 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