<html> <head> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>Foreign Keys</title> <link rel="stylesheet" type="text/css" href="../../../../style.css"> </head> <body> <div class="CommonContent"> <div class="CommonContentArea"> <h1>Foreign Keys</h1> <p>Foreign keys issue is closely connected to the issue of <a href="identity_and_primary_keys.html" class="wikiLink">object idenity</a>. </p> <p>In RDBMS foreign keys are created by designating a special column (or set of columns) in 2 different tables to hold the same information. The data in a row of one table is related to the data in a row of another table if the values in those columns match. Usually primary key is used on one side of the equation (can be replaced by unique key). Foreign keys are also called <a href="referential_integrity.html" class="wikiLink">referential constraints</a>.</p> <p>In db4o there is no concept of a primary key, therefore no foreign key as well. Object relationships are established through direct object references, which are kept in object fields. This approach is perfectly straightforward and intuitive. It considerably simplifies the navigation: instead of issuing more and more queries to access child (referenced) objects, you can just get them by the reference in the object field. This is definitely much more productive and requires less coding.</p> However, object references fulfill only part of foreign key responsibilities: in addition to referencing another data entity, foreign key ensures the referential integrity. The <a href="referential_integrity.html" class="wikiLink">following chapter</a> discusses how referential integrity can be implemented in db4o. </div> </div> <div id="footer"> This revision (2) was last Modified 2007-06-02T20:23:35 by Tetyana. </div> </body> </html>