Caché Class Definition Reference
IdKey
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

Specifies whether this index defines the Object Identity values for the table.
Usage
To specify that the Object Identity values for this table should be formed from the property or properties on which this index is based, use the following syntax:
Index name On property_expression_list [ IdKey ];
Otherwise, omit this keyword or place the word Not immediately before the keyword.
Details
This keyword specifies that the property or properties on which this index is based will be used to form the Object Identity value for this object.
Important:
There must not be a sequential pair of vertical bars (||) within the values of any property used by an IDKEY index, unless that property is a valid reference to an instance of a persistent class. This restriction is imposed by the way in which the Caché SQL mechanism works. The use of || in IDKey properties can result in unpredictable behavior.
The Object Identity value is used to uniquely locate persistent object instances. Once an object using IdKey has been saved, you cannot modify the values of any of the properties that make up the IdKey.
An IdKey index also behaves like a unique index. That is, for the property (or the combination of properties) that you use in this index, Caché enforces uniqueness. It is permitted, but redundant, to specify the Unique keyword as true in this index definition.
Default
The Default for the IdKey keyword is false.
See Also