Differences between revisions 9 and 10
Revision 9 as of 2007-03-22 06:13:27
Size: 1842
Editor: lresende
Comment:
Revision 10 as of 2009-09-20 22:48:06
Size: 1844
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
The RDB DAS provides the ability to work with single-column keys as well as keys composed of multiple columns ([http://en.wikipedia.org/wiki/Compound_key compound keys]). RDB DAS clients can specify the primary key for a table as well as foreign keys that reference other tables. The primary key for a table can be identified to the DAS via configuration (typically via a configuration xml file). The following is an example config file that defines a compound primary key: The RDB DAS provides the ability to work with single-column keys as well as keys composed of multiple columns ([[http://en.wikipedia.org/wiki/Compound_key|compound keys]]). RDB DAS clients can specify the primary key for a table as well as foreign keys that reference other tables. The primary key for a table can be identified to the DAS via configuration (typically via a configuration xml file). The following is an example config file that defines a compound primary key:

The RDB DAS provides the ability to work with single-column keys as well as keys composed of multiple columns (compound keys). RDB DAS clients can specify the primary key for a table as well as foreign keys that reference other tables. The primary key for a table can be identified to the DAS via configuration (typically via a configuration xml file). The following is an example config file that defines a compound primary key:

   <Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        
      <Table tableName="ORDERDETAILS">
         <Column columnName="ORDERID" primaryKey="true"/>
         <Column columnName="PRODUCTID" primaryKey="true"/>
      </Table>
    
   </Config>

Relationships between tables are in terms of primary keys and foreign keys and so foreign keys can also be compound. The following example illustrates a relationship using a compound foreign key:

   <Config xsi:noNamespaceSchemaLocation="http:///org.apache.tuscany.das.rdb/config.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        
      <Table tableName="ORDERDETAILS">
         <Column columnName="ORDERID" primaryKey="true"/>
         <Column columnName="PRODUCTID" primaryKey="true"/>
      </Table>
    
      <Table tableName="ORDERDETAILSDESC">
         <Column columnName="ID" primaryKey="true"/>
      </Table>

      <Relationship name="orderDetailsDesc" primaryKeyTable="ORDERDETAILS" 
                     foriegnKeyTable="ORDERDETAILSDESC" many="true">
         <KeyPair primaryKeyColumn="ORDERID" foriegnKeyColumn="ORDERID"  />
         <KeyPair primaryKeyColumn="PRODUCTID" foreignKeyColumn="PRODUCTID" />
      </Relationship>
   </Config>

WorkingWithCompoundKeys (last edited 2009-09-20 22:48:06 by localhost)