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="">
   <Table tableName="ORDERDETAILS">
      <Column columnName="ORDERID" primaryKey="true"/>
      <Column columnName="PRODUCTID" primaryKey="true"/>
    <Table tableName="ANORDER">
       <Column columnName="ID" primaryKey="true"/>
   <Relationship name="ORDERDETAILS" primaryKeyTable="ANORDER"
        foreignKeyTable="ORDERDETAILS" many="true">
        <KeyPair primaryKeyColumn="ID" foreignKeyColumn="ORDERID"/>

To be continued ...