tuscany-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ritika Maheshwari <riti...@us.ibm.com>
Subject how to define non contained relationships
Date Wed, 23 Aug 2006 18:29:14 GMT
here is the xsd which I am inputting to XSD2JavaGenerator

schema 
xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://www.ibm.com/websphere/fvt/ejbquery/emf"
xmlns:ritika="http://www.ibm.com/websphere/fvt/ejbquery/emf"
xmlns:sdo="commonj.sdo/XML"
xmlns:sdoJava="commonj.sdo/java"
sdoJava:package="com.ibm.websphere.fvt.ejbquery.emf">
<complexType name="DataGraphRoot">
    <sequence>
      <element maxOccurs="unbounded" minOccurs="0" name="deptMed" 
type="ritika:DeptMed"/>
      <element maxOccurs="unbounded" minOccurs="0" name="empMed" 
type="ritika:EmpMed"/>
      <element maxOccurs="unbounded" minOccurs="0" name="projectMed" 
type="ritika:ProjectMed"/>
      <element maxOccurs="unbounded" minOccurs="0" name="taskMed" 
type="ritika:TaskMed"/>
      <!-- <element name="changeSummary" type="sdo:ChangeSummaryType" /> 
-->
    </sequence>
  </complexType>
<complexType name="DeptMed">
   <sequence>
    <element name="deptno" type="int"/>
    <element name="name" type="string"/>
    <element name="budget" type="double"/>
    <element sdo:oppositeProperty="manages" 
sdo:propertyType="ritika:EmpMed" name="mgr" type="ritika:EmpMed" />
    <element sdo:oppositeProperty="dept" 
sdo:propertyType="ritika:ProjectMed"  name="proj" type="ritika:ProjectMed" 
/>
    <element sdo:oppositeProperty="dept" sdo:propertyType="ritika:EmpMed" 
name="emp" type="ritika:EmpMed"  />
   </sequence>
  </complexType>
<complexType name="EmpMed">
    <sequence>
    <element name="empid" type="int"/>
    <element name="name" type="string"/>
    <element name="salary" type="double"/>
    <element name="bonus" type="double"/>
    <element sdo:oppositeProperty="emp" sdo:propertyType="ritika:DeptMed" 
name="dept" type="ritika:DeptMed" />
    <element sdo:oppositeProperty="emp" sdo:propertyType="ritika:TaskMed" 
name="task" type="ritika:TaskMed" />
    <element sdo:oppositeProperty="mgr" sdo:propertyType="ritika:DeptMed" 
name="manages" type="ritika:DeptMed" />
    </sequence>
  </complexType>
 <complexType name="ProjectMed">
     <sequence>
    <element name="projid" type="int"/>
    <element name="cost" type="double"/>
    <element name="startDate" type="dateTime" 
sdoJava:instanceClass="java.sql.Timestamp"/>
    <element name="endDate" type="dateTime" 
sdoJava:instanceClass="java.sql.Timestamp"/>
    <element sdo:oppositeProperty="proj" sdo:propertyType="ritika:DeptMed" 
name="dept" type="ritika:DeptMed" />
    <element sdo:oppositeProperty="proj" sdo:propertyType="ritika:TaskMed" 
name="task" type="ritika:TaskMed" />
    </sequence>
  </complexType>
<complexType name="TaskMed">
    <sequence>
    <element name="taskid" type="int"/>
    <element name="description" type="string"/>
    <element name="startDate" type="dateTime" 
sdoJava:instanceClass="java.sql.Timestamp" />
    <element name="endDate" type="dateTime" 
sdoJava:instanceClass="java.sql.Timestamp" />
    <element sdo:oppositeProperty="task" 
sdo:propertyType="ritika:ProjectMed" name="proj" 
type="ritika:ProjectMed"/>
    <element sdo:oppositeProperty="task" sdo:propertyType="ritika:EmpMed" 
name="emp" type="ritika:EmpMed" />
    </sequence>
  </complexType>
</schema>


Now if I set the manages relationship on Employee to dept2 like this
emp1.setManages(dept2);

Then the manages relationship on emp1 is updated to dept2. But dept 2 
eContainer becomes emp1 and its mgr relation still remains null.Although 
it is the inverse relation of the manages.Ideally it should have been set 
to Emp1.
The behaviour which I wanted to attain was to have EmpMed , DeptMed, 
ProjectMed and TaskMed classes to be contained within DataGraphRoot.And 
any relations between these four classes to be non contained.
I believe that to attain this behaviour the XSD needs to be modified.But I 
do not find any examples could some one provide some input please


ritika

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message