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.
Relationship Basics<br />
the relationship Invoice.Items has cardinality of CHILDREN because Items is a collection of<br />
children from the point of view of Invoice. LineItem.TheInvoice has cardinality of PARENT<br />
because TheInvoice refers to the parent of this LineItem.<br />
The cardinality value of a relationship must correspond to the cardinality value of the inverse<br />
relationship as defined in the following table:<br />
ONE<br />
MANY<br />
PARENT<br />
CHILDREN<br />
MANY<br />
ONE<br />
CHILDREN<br />
PARENT<br />
14.1.2 Defining a Relationship<br />
To create a relationship, there are a pair of complementary relationship properties. In the<br />
<strong>Caché</strong> Studio you can define a relationship property using the New Property Wizard and<br />
checking the Relationship option. See the Relationships section of the Studio documentation<br />
for details.<br />
When you define a relationship property, Studio automatically creates the inverse relationship<br />
property in the associated class.<br />
You can also define a relationship property directly in Studio. The syntax is:<br />
Relationship Name As Type<br />
[Inverse = related_class,<br />
Cardinality = cardinality_type<br />
where<br />
• “TYPE” , “INVERSE” and “CARDINALITY” are required.<br />
• related_class specifies the other half of the relationship and must be a persistent class.<br />
• cardinality_type, the value of cardinality, indicates the complementary cardinality of<br />
related_class (and can have a value of ONE, MANY, PARENT, or CHILDREN).<br />
For example, here are the definitions of two related classes, Company and Employee. Company<br />
is:<br />
<strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong> 127