Miro,
Both sides of a relationship defined with sdoXML:oppositeProperty need to
be non-containment references. All containment references are implicitly
bidirectional (the reverse is the elements container), so you wouldn't
really want to use an IDREF element anyway - it's just duplicate
information.
To get the SoH from an SoL, you can call:
SoH soh = (SoH)sol.getContainer();
You could manually add a getOrder() (convenience) method in the generated
class like this:
SoH getOrder() { return (SoH)getContainer(): }
EMF has a way to generate this kind of method for you, but there's no
support for this in SDO.
Frank.
"Miro Kandic \(mkandic\)" <[EMAIL PROTECTED]> wrote on 09/14/2007 08:40:40
PM:
> I am having a problem with new XSD2JavaGenerator (M2 was OK) and it
> generates code that cannot be compiled in case when container
> element has non-containment reference to the container.
> Entire xsd file is attched.
> In this case I want to use static API and I want to get sales order
> header (SoH) from its lines (SoL) using the same Java code (getter)
> as in case when I use corresponding POJO's.
> It works fine if property is non-containment reference to no
> container class (SoL references product or SoH references Customer).
>
> I am a new in this community and I do not know if this is considered
> as a bug who and how should open it. Please, advise.
>
> <xsd:complexType name="SoH">
> <xsd:sequence>
> <xsd:element name="customer" type="xsd:IDREF" sdoxml:
> propertyType="impl:Customer" sdoxml:oppositeProperty="soHs"
> 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="order" type="xsd:IDREF" sdoxml:
> propertyType="impl:SoH" sdoxml:oppositeProperty="lines"
> minOccurs="1" maxOccurs="1" />
> <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>
>
> Regards,
> Miro
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]