Differences between revisions 4 and 5
Revision 4 as of 2006-10-12 02:48:53
Size: 1657
Comment:
Revision 5 as of 2009-09-20 22:48:39
Size: 1659
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 [http://en.wikipedia.org/wiki/Compound_key compound keys]. Keys must be identified to the DAS for two purposes: flushing changes to the database and defining a relationship. In either case, the keys can be single-colomn or compound. The RDB DAS provides the ability to work with single-column keys as well as [[http://en.wikipedia.org/wiki/Compound_key|compound keys]]. Keys must be identified to the DAS for two purposes: flushing changes to the database and defining a relationship. In either case, the keys can be single-colomn or compound.

The RDB DAS provides the ability to work with single-column keys as well as compound keys. Keys must be identified to the DAS for two purposes: flushing changes to the database and defining a relationship. In either case, the keys can be single-colomn or compound.

We'll start with the first purpose: flushing changes to the database (also called "apply changes processing"). As part of change summary processing, the DAS will generate a set of INSERT, UPDATE and DELETE statements for execution against the database and these statements require a primary key. So, although the primary key definition is not required for reading data, it is required for writeing data via apply changes processing.

The primary key for a table can be identified to the DAS via configuration (typically via a configuration xml file). The follwing 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>
 
    <Table tableName="ANORDER">
       <Column columnName="ID" primaryKey="true"/>
    </Table>
           
   <Relationship name="ORDERDETAILS" primaryKeyTable="ANORDER"
        foreignKeyTable="ORDERDETAILS" many="true">
        <KeyPair primaryKeyColumn="ID" foreignKeyColumn="ORDERID"/>
    </Relationship>
    
</Config>

To be continued ...

Tuscany/TuscanyJava/DAS_Java_Overview/RDBDAS_Java_User_Guide/compound_keys (last edited 2009-09-20 22:48:39 by localhost)