25.01.2015 Views

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

Using Caché Objects - InterSystems Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Relationships<br />

14.1 Relationship Basics<br />

The fundamental aspects of using relationships are relationship keywords and the action of<br />

defining a relationship.<br />

14.1.1 Relationship Keywords<br />

There are three keywords or modifiers required to define a relationship property:<br />

TYPE<br />

The type (class name) of the related class. This must be a persistent class.<br />

INVERSE<br />

CARDINALITY<br />

The name of the corresponding relationship property in the related class (the “other<br />

side” of the relationship).<br />

The cardinality of this side of the relationship. This is either “ONE” , “MANY” ,<br />

“PARENT” , or “CHILDREN” — where the class' inverse has the complementary<br />

cardinality, such as MANY with ONE or PARENT with CHILDREN<br />

Because each relationship is defined using a relationship property, which is a particular kind<br />

of property, some other property keywords are available for use in them, including<br />

“DESCRIPTION” , “FINAL” , “REQUIRED” , “SQLFIELDNAME” and “PRIVATE” .<br />

Some property keywords, such as “MULTIDIMENSIONAL” , do not apply. See the Property<br />

Keywords section of the Class Definition Reference for more information.<br />

14.1.1.1 About Cardinality<br />

The value of “CARDINALITY” defines how the relationship “appears” from this side as<br />

well as whether it is an independent relationship (ONE-MANY) or dependent relationship<br />

(PARENT-CHILDREN).<br />

For example, suppose we have a Book object that is related to MANY Chapter objects:<br />

The relationship Book.Chapters has cardinality of MANY. Each Chapter is related to ONE<br />

Book so the Chapter.Book relationship has cardinality of ONE.<br />

In the case of a dependent relationship, such as an Invoice object with dependent LineItem<br />

objects,<br />

126 <strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!