Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » wrong xsd is generated for subclass
wrong xsd is generated for subclass [message #1375141] Thu, 22 May 2014 23:39
jason zhang is currently offline jason zhangFriend
Messages: 31
Registered: July 2009
Member
This is my mapping file
<?xml version="1.0" encoding="UTF-8"?>
<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
	xml-accessor-type="NONE" xml-mapping-metadata-complete="true"
	package-name="com.flexdms.flexims.dynamic.model.generated">
	<java-types>
		<java-type name="TypedQuery">
			<xml-root-element name="TypedQuery" />
			<xml-virtual-access-methods get-method="realGet"
				set-method="realSet" schema="NODES" />
			<java-attributes>
				<xml-element java-attribute="fxversion" name="fxversion"
					type="java.sql.Timestamp" />
				<xml-element java-attribute="Name" name="Name"
					type="java.lang.String" />
				<xml-element java-attribute="id" name="id" type="java.lang.Long"
					xml-id="true" />
			</java-attributes>
		</java-type>

		<java-type name="JPQL"
			super-type="com.flexdms.flexims.dynamic.model.generated.TypedQuery">
			<xml-root-element name="JPQL" />
			<xml-virtual-access-methods get-method="realGet"
				set-method="realSet" schema="NODES" />
			<java-attributes>
				<xml-element java-attribute="JPQLText" name="JPQLText"
					type="java.lang.String" />
			</java-attributes>
		</java-type>
		<java-type name="JPQL1"
			super-type="com.flexdms.flexims.dynamic.model.generated.TypedQuery">
			<xml-root-element name="JPQL1" />
			<xml-virtual-access-methods get-method="realGet"
				set-method="realSet" schema="NODES" />
			<java-attributes>
				<xml-element java-attribute="JPQL1Text" name="JPQL1Text"
					type="java.lang.String" />
			</java-attributes>
		</java-type>
	</java-types>
</xml-bindings>



code to generate XSD file
	ClassLoader myClassLoader=Thread.currentThread().getContextClassLoader();
			InputStream iStream = myClassLoader.getResourceAsStream("com/flexdms/flexims/unit/moxy/inheritance.xml");
			
			Map<String, Object> properties = new HashMap<String, Object>();
			properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, iStream);
			DynamicJAXBContext jaxbContext = DynamicJAXBContextFactory.createContextFromOXM(myClassLoader, properties);
			jaxbContext.generateSchema(new SchemaOutputResolver() {
				
				@Override
				public Result createOutput(String namespaceUri, String suggestedFileName) throws IOException {
					StreamResult result = new StreamResult(System.out);
					//result.setSystemId(file.toURI().toURL().toString());
					return result;
				}
			});


The generate xsd
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <xsd:complexType name="jpql">
      <xsd:complexContent>
         <xsd:extension base="jpql">
            <xsd:sequence>
               <xsd:element name="fxversion" minOccurs="0"/>
               <xsd:element name="Name" type="xsd:string" minOccurs="0"/>
               <xsd:element name="id" type="xsd:long" minOccurs="0"/>
               <xsd:element name="JPQLText" type="xsd:string" minOccurs="0"/>
            </xsd:sequence>
         </xsd:extension>
      </xsd:complexContent>
   </xsd:complexType>
   <xsd:complexType name="jpql1">
      <xsd:complexContent>
         <xsd:extension base="jpql1">
            <xsd:sequence>
               <xsd:element name="fxversion" minOccurs="0"/>
               <xsd:element name="Name" type="xsd:string" minOccurs="0"/>
               <xsd:element name="id" type="xsd:long" minOccurs="0"/>
               <xsd:element name="JPQL1Text" type="xsd:string" minOccurs="0"/>
            </xsd:sequence>
         </xsd:extension>
      </xsd:complexContent>
   </xsd:complexType>
   <xsd:complexType name="typedQuery">
      <xsd:sequence>
         <xsd:element name="fxversion" minOccurs="0"/>
         <xsd:element name="Name" type="xsd:string" minOccurs="0"/>
         <xsd:element name="id" type="xsd:long" minOccurs="0"/>
      </xsd:sequence>
   </xsd:complexType>
   <xsd:element name="JPQL" type="jpql"/>
   <xsd:element name="TypedQuery" type="typedQuery"/>
   <xsd:element name="JPQL1" type="jpql1"/>
</xsd:schema>


The subclass xsd extends itself instead of super class.

Is this a bug?

thanks
Previous Topic:Problem adding more entity classes
Next Topic:Eclipselink 2.3 deadlock issues
Goto Forum:
  


Current Time: Fri May 29 18:33:35 GMT 2015

Powered by FUDForum. Page generated in 0.02862 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software