Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
Using Caché Objects - InterSystems Documentation
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Objects</strong> and SQL<br />
The identity column has the name “ID” , unless the object has a property named “ID” ; in<br />
that case, the identity column has “ID1” as its name. (If there are ID and ID1 properties, the<br />
identity column has “ID2” as its name, and so on.)<br />
13.2.1.1 ID Column Constraints<br />
Though the ID appears as a column in the projection, there is no need to create an index based<br />
on it, as it is already the IDKEY for the table; further, it has no equivalent property, so an index<br />
created specifically for a class' SQL projection is not meaningful for the class itself.<br />
Additionally, you cannot perform UPDATE or INSERT operations on it, since <strong>Caché</strong> generates<br />
ID values automatically. For instance, here is the syntax to add a new instance of a<br />
class through its projection (where the ID column is created from the class OID):<br />
INSERT INTO PERSON (FNAME, LNAME)VALUES (:fname, :lname)<br />
and not:<br />
INSERT INTO PERSON (ID, FNAME, LNAME)VALUES (:id, :fname, :lname)<br />
Because the ID field is handled automatically, you do not need to refer to it explicitly.<br />
13.2.2 Properties<br />
When projected, most properties appear in a relational table as columns (fields), where the<br />
column takes its name from the property; the exception is arrays, which are projected as child<br />
tables by default.<br />
All a class' properties are projected, aside from the following exceptions:<br />
• Transient properties<br />
• Calculated properties<br />
• Private properties<br />
• Multidimensional properties<br />
For information on managing the projection of transient or calculated properties, see Transient<br />
and Calculated Properties.<br />
116 <strong>Using</strong> <strong>Caché</strong> <strong>Objects</strong>