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.
12<br />
Object Persistence<br />
One of the most important features of <strong>Caché</strong> <strong>Objects</strong> is Object Persistence: the ability to store<br />
and retrieve objects within a database.<br />
Within <strong>Caché</strong>, object persistence is automatic and built-in: you do not need to write any<br />
persistence code; you do not need to provide any object/relational “mapping” ; and you do<br />
not have to bother with middleware and database connectivity tools.<br />
Every persistent object is automatically projected as an SQL table. This is described in the<br />
<strong>Objects</strong> and SQL chapter.<br />
<strong>Caché</strong> provides two flavors of object identity that you can use identify persistent objects: ID<br />
and OID. An ID is a simple literal value (by default, an integer) that is unique within a specific<br />
extent of objects (say the set of all Person objects). An OID is more general: it also includes<br />
the object's class name and is unique across a database of objects. In general practice, an<br />
application never needs to use the OID value; the ID value is usually sufficient. Within this<br />
chapter, we will use the ID variant of the various persistence methods (such as %OpenId)<br />
for simplicity.<br />
12.1 The %Persistent Class<br />
Object persistence is provided by the %Persistent class, which defines the methods of the<br />
Persistence Interface; and the Class Compiler, which manages Schema Evolution and SQL<br />
Projection.<br />
To be persistent, two things must be true about a class definition:<br />
<strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong> 99