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.
Object Persistence<br />
If a persistent class, B, is a subclass of another persistent class, A, then all of the stored<br />
instances of B (as well as subclasses of B) belong to the superclass extent A as well as to the<br />
subextent B.<br />
The top-most class in a hierarchy of persistent classes (that is, the first superclass marked as<br />
persistent) is referred to as a root class and defines the top-level extent. The root class defines<br />
the primary storage used by all objects stored within the extent. If the root class specifies that<br />
its instances will be stored within the global ^MyApp.Data, then all subclasses in this extent<br />
are also stored there. Note that the root class of an extent can be marked as Abstract meaning<br />
that there are no actual instances of this class stored within its extent.<br />
An extent that includes objects of different subtypes is referred to as a multi-class extent.<br />
Note that as far as persistence is concerned only the primary (first) superclass of an object<br />
determines its type and what extent it belongs to.<br />
Suppose we define the following persistent objects:<br />
• MyApp.Person — a persistent class (directly derived from %Persistent).<br />
• MyApp.Teacher — a persistent class derived from MyApp.Person.<br />
• MyApp.Student — a persistent class derived from MyApp.Person.<br />
• MyApp.GradStudent — a persistent class derived from MyApp.Student.<br />
In this case, the root class is MyApp.Person as it is directly derived from %Persistent.<br />
MyApp.Person defines the top-level extent MyApp.Person.<br />
MyApp.Teacher defines the subextent MyApp.Teacher. All instances of MyApp.Teacher belong<br />
the to top-level MyApp.Person extent as well as the MyApp.Teacher subextent.<br />
Similarly, MyApp.Student defines the subextent MyApp.Student. All instances of MyApp.Student,<br />
as well as its subclass MyApp.GradStudent, belong the to top-level MyApp.Person extent as<br />
well as the MyApp.Student subextent.<br />
MyApp.GradStudent is a subclass of MyApp.Student. It defines the subextent<br />
MyApp.GradStudent. All instances of MyApp.GradStudent belong the to top-level MyApp.Person<br />
extent, the MyApp.Student subextent, and the MyApp.GradStudent subextent.<br />
12.3.1 The Extent Query<br />
Every persistent class automatically includes a class query called Extent that provides a set<br />
of all the object ID values within an object extent.<br />
108 <strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong>