ws-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Ws Wiki] Update of "WorkingWithStaticDataObjects" by KevinWilliams
Date Mon, 30 Oct 2006 22:01:26 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Ws Wiki" for change notification.

The following page has been changed by KevinWilliams:
http://wiki.apache.org/ws/WorkingWithStaticDataObjects

------------------------------------------------------------------------------
  
  The following example demostrates the RDB DAS wih Static SDO Types:
  {{{
-    DAS das = DAS.FACTORY.createDAS(getConfig("staticCustomerOrder.xml"), getConnection());
- 
-    Command select = das.getCommand("Customer and Orders");
- 
     SDOUtil.registerStaticTypes(CustomerFactory.class);
  
+    DAS das = DAS.FACTORY.createDAS(getConfig("staticCustomerOrder.xml"), getConnection());
+    Command select = das.getCommand("Customer and Orders");
     select.setParameter(1, Integer.valueOf(1));
- 
     DataObject root = select.executeQuery();
  
     // Modify a customer
@@ -34, +31 @@

     das.applyChanges((DataObject) root);
  }}}
  
+ And, here is the associated config file:
+ {{{
+    <Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+      dataObjectModel="http:///org.apache.tuscany.das.rdb.test/customer.xsd">
+ 
+     <Command name="Customer and Orders" SQL="SELECT * FROM CUSTOMER LEFT JOIN ANORDER
ON CUSTOMER.ID = ANORDER.CUSTOMER_ID where CUSTOMER.ID = ?" kind="Select"/>
+ 		
+     <Table tableName="CUSTOMER" typeName="Customer">
+       <Column columnName="ID" primaryKey="true"/>
+     </Table>
+ 
+     <Table tableName="ANORDER" typeName="AnOrder">
+       <Column columnName="ID" primaryKey="true"/>
+       <Column columnName="CUSTOMER_ID"/>
+     </Table>
+ 	
+     <Relationship name="orders" primaryKeyTable="CUSTOMER" foreignKeyTable="ANORDER"
many="true">
+        <KeyPair primaryKeyColumn="ID" foreignKeyColumn="CUSTOMER_ID"/>
+     </Relationship>	
+   
+    </Config>
+ }}}
+ 
+ The first line of the example registers the Static model with the SDO runtime. This step
would not normally be intermixed with the data access code but the Types must be registered
by some part of the applicaiton.
+ 

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@ws.apache.org
For additional commands, e-mail: general-help@ws.apache.org


Mime
View raw message