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.

<strong>Objects</strong> and SQL<br />

SELECT ID,Name,Title,TheCompany->Name<br />

FROM Employee<br />

ORDER BY Name<br />

The multi-valued side is not projected as a field (Multi-valued relationships are state-less on<br />

disk and SQL does not deal with in-memory objects). Instead, you must perform a simple<br />

join based on the multi-valued side's ID value and the single-valued side's reference field:<br />

SELECT c.Name, e.Name<br />

FROM Company c, Employee e<br />

WHERE e.TheCompany = c.ID<br />

ORDER By 1,2<br />

A single-valued relationship with cardinality of ONE is projected to SQL as a FOREIGNKEY<br />

with NOACTION specified for UPDATE and DELETE.<br />

If the cardinality of the single-valued relationship is PARENT then the table projected from<br />

the class containing the relationship is “adopted” as a child table by the table projected from<br />

the type class of the single-valued relationship.<br />

124 <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!