XSD2JavaGenerator has a problem with associations navigable from both sides
---------------------------------------------------------------------------

                 Key: TUSCANY-1725
                 URL: https://issues.apache.org/jira/browse/TUSCANY-1725
             Project: Tuscany
          Issue Type: Bug
          Components: Java SDO Tools
    Affects Versions: Java-SDO-1.0
         Environment: Linux
            Reporter: Miro kandic


XSD2JavaGenerator does not work in the case of any association type 
(association, composition) that is navigable from both sides.
I have intentionally, just to test generator, made Customer-SoH association in 
the next schema navigable from both sides and generated code cannot be compiled.
Frank, after initial analyses, confirmed that saying "Bidirectional references 
are broken in Tuscany. They seem
to have been broken when we switched over to the new (noEMF) codegen
patterns."


Next is complete XSD built automatically from the UML model.

<?xml version="1.0" encoding="UTF-8"?>
<!--
    Attention: Generated code! Do not modify by hand!
    Generated by: XmlSchema.vsl in andromda-xmlschema-cartridge.
  -->
<xsd:schema
    targetNamespace="http://www.cisco.com/odns/soa";
    xmlns:xsd="http://www.w3.org/2001/XMLSchema";
    xmlns:sdo="commonj.sdo" xmlns:sdoxml="commonj.sdo/xml"
    xmlns:impl="http://www.cisco.com/odns/soa";
    elementFormDefault="qualified">

    <xsd:import namespace="commonj.sdo/xml" schemaLocation="sdoXML.xsd"/>

    <xsd:complexType name="Address">
        <xsd:sequence>
            <xsd:element name="street" type="xsd:string" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="city" type="xsd:string" minOccurs="1" 
maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="xmlId" type="xsd:ID"/>
    </xsd:complexType>

    <xsd:complexType name="Customer">
        <xsd:sequence>
            <xsd:element name="orders" type="xsd:IDREF" 
sdoxml:propertyType="impl:SoH"
                sdoxml:oppositeProperty="customer" minOccurs="0" 
maxOccurs="unbounded" />
            <xsd:element name="name" type="xsd:string" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="created" type="xsd:date" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="lastUpdated" type="xsd:dateTime" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="modifiedBy" type="xsd:string" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="id" type="xsd:long" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="xmlId" type="xsd:ID"/>
    </xsd:complexType>

    <xsd:complexType name="Part">
        <xsd:sequence>
            <xsd:element name="uom" type="xsd:string" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="aggState" type="xsd:string" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="id" type="xsd:long" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="xmlId" type="xsd:ID"/>
    </xsd:complexType>

    <xsd:complexType name="Product">
     <xsd:complexContent>
      <xsd:extension base="impl:Part">
        <xsd:sequence>
            <xsd:element name="description" type="xsd:string" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="modifiedBy" type="xsd:string" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="lastUpdated" type="xsd:dateTime" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="created" type="xsd:date" minOccurs="1" 
maxOccurs="1"/>
        </xsd:sequence>
      </xsd:extension>
     </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="SoH">
        <xsd:sequence>
            <xsd:element name="customer" type="xsd:IDREF" 
sdoxml:propertyType="impl:Customer"
                sdoxml:oppositeProperty="orders" minOccurs="1" maxOccurs="1" />
            <xsd:element name="lines" type="impl:SoL" minOccurs="0" 
maxOccurs="unbounded" />
            <xsd:element name="number" type="xsd:string" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="receivedDate" type="xsd:date" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="modifiedBy" type="xsd:string" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="lastUpdated" type="xsd:dateTime" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="created" type="xsd:date" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="id" type="xsd:long" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="xmlId" type="xsd:ID"/>
    </xsd:complexType>

    <xsd:complexType name="SoL">
        <xsd:sequence>
            <xsd:element name="product" type="xsd:IDREF" 
sdoxml:propertyType="impl:Product"
                sdoxml:oppositeProperty="soLs" minOccurs="1" maxOccurs="1" />
            <xsd:element name="soLineSch" type="impl:SoLSch" minOccurs="0" 
maxOccurs="unbounded" />
            <xsd:element name="quantity" type="xsd:double" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="requestedDate" type="xsd:date" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="modifiedBy" type="xsd:string" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="lastUpdated" type="xsd:dateTime" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="created" type="xsd:date" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="id" type="xsd:long" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="xmlId" type="xsd:ID"/>
    </xsd:complexType>

    <xsd:complexType name="SoLSch">
        <xsd:sequence>
            <xsd:element name="requestedDate" type="xsd:date" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="quantity" type="xsd:double" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="modifiedBy" type="xsd:string" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="lastUpdated" type="xsd:dateTime" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="created" type="xsd:date" minOccurs="1" 
maxOccurs="1"/>
            <xsd:element name="id" type="xsd:long" minOccurs="1" maxOccurs="1"/>
        </xsd:sequence>
        <xsd:attribute name="xmlId" type="xsd:ID"/>
    </xsd:complexType>

    <xsd:element name="DataGraphRootEl" type="impl:DataGraphRoot"/>
    <xsd:complexType name="DataGraphRoot">
        <xsd:sequence>
            <xsd:element name="customer" type="impl:Customer" minOccurs="0" 
maxOccurs="unbounded" />
            <xsd:element name="product" type="impl:Product" minOccurs="0" 
maxOccurs="unbounded" />
            <xsd:element name="part" type="impl:Part" minOccurs="0" 
maxOccurs="unbounded" />
            <xsd:element name="soH" type="impl:SoH" minOccurs="0" 
maxOccurs="unbounded" />
        </xsd:sequence>
    </xsd:complexType>

</xsd:schema>


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to