Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
14<br />
Relationships<br />
A relationship is an association between two objects, each of a specific type; to create a<br />
relationship between two objects, each must have a relationship property, which defines its<br />
half of the relationship.<br />
For example, a Company class may define a one-to-many relationship with an Employee<br />
class. In this case, there may be zero or more Employee objects associated with each Company<br />
object.<br />
<strong>Caché</strong> relationships have the following characteristics:<br />
• Relationships are binary, that is a relationship is defined either between two, and only<br />
two, classes or between a class and itself).<br />
• Relationships can only be defined for persistent classes.<br />
• Relationships must be bi-directional, that is both sides of a relationship must be defined.<br />
• Currently, <strong>Caché</strong> supports two types of relationship: one-to-many (independent) and<br />
parent-to-children (dependent). One-to-one and many-to-many relationships are not<br />
supported at this time.<br />
• Relationships automatically provide referential integrity; unlike a reference (or objectvalued)<br />
property, the value of the relationship is constrained to be correct (that is, there<br />
are no dangling references).<br />
• Relationships automatically manage their in-memory and on-disk behavior.<br />
• Relationships provide superior scaling and concurrency over object collections.<br />
• Relationships are visible to SQL as foreign keys. See the Object-SQL Projection for more<br />
information on this topic.<br />
<strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong> 125