|Apache Tuscany > Home > DAS Overview > DAS C++ > DAS C++ Documentation Menu > RDB DAS C++ - User Guide > RDB DAS CPP - ForeignKeyRepresentationAndManagement||User List | Dev List | Issue Tracker|
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). 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.