You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by co...@apache.org on 2007/10/25 23:17:00 UTC

[CONF] Apache Tuscany: RDB DAS C++ ForeignKeyRepresentationAndManagement (page created)

RDB DAS C++ ForeignKeyRepresentationAndManagement (TUSCANY) created by Adriano Crestani
   http://cwiki.apache.org/confluence/pages/viewpage.action?pageId=69456

Content:
---------------------------------------------------------------------

h1. ForeignKeyRepresentationAndManagement

Database table foreign keys map to DataObjects as relationships to other DataObjects. Consider two tables: DEPARTMENT and EMPLOYEE and assume the EMPLOYEE table has a FK column DEPT_ID that references a row in the DEPARTEMENT table.

If you use the DAS to read a particular department and all of its related employees then you will end up with a DEPARTMENT DataObject that has a property named "EMPLOYEE" that is a reference to a list of related EMPLOYEE DataObjects. You can navigate directly to the employees via this property like this: department->getList("EMPLOYEE").

As DEPARTMENT PK is stored on the DataObject, a reference to a EMPLOYEE DataObject  does not need to store the DEPARTMENT FK, because the DEPARTMENT FK and DEPARTMENT PK should be the same according to [Referential Integrity (RI)|http://en.wikipedia.org/wiki/Referential_integrity]. So, if a EMPLOYEE is removed from a DEPARTMENT to another, when DAS apply the changes back to the database, it needs only to get the PK value from the new DEPARTENT that references the EMPLOYEE and set it on its DEPARTMENT FK.

---------------------------------------------------------------------
CONFLUENCE INFORMATION
This message is automatically generated by Confluence

Unsubscribe or edit your notifications preferences
   http://cwiki.apache.org/confluence/users/viewnotifications.action

If you think it was sent incorrectly contact one of the administrators
   http://cwiki.apache.org/confluence/administrators.action

If you want more information on Confluence, or have a bug to report see
   http://www.atlassian.com/software/confluence



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