company logo

Name ereferences

Sometimes, references to instances are required, which do not exist in the database (e.g. when overloading object spaces). In this case, reference by name is supported. Technically, a reference by name is an index entry without LOID, i.e. without database address. For single references, which do not got an index, a key instance is referenced instead of the instance. For multiple index collections, only the main index may contain references by name.

References by name are supported for any not owning relationship, i.e. relationships that have got a super set (base collection). In order to read the instance referenced by name, the name is looked up in the super set. When the super set is a subset of another super set and contains a reference by name, too, the instance is searched in the next super set etc.

Name references (reference by name) are stored as key instances, i.e. instances, that do not contain relationships or references, but key attributes (attributes used as key components), only. Similar to instance references, name references are stored in indexes or single references. This allows referring to instances not stored in the database by one or more key values. Name references may be upgraded to instance references when adding an instance with appropriate key attributes to database.

Creating a reference by name for an owning collection will just create a name reference in the index but no instance reference. For not owning collections name references are created in the topmost super set. Usually, references by name cannot be resolved, but in case of overloaded object spaces those may exist in one of the overloaded object spaces.

In order to create a name reference one may call insertKey() or appendKey(). When reading (get()) an instance via name references that cannot be resolved, the instance containing the key value(s), only, will be provided and the state of the instance is selected and located, but not positioned. Updating the instance will create a physical instance and turns the name reference into an instance reference. The name reference becomes an instance reference also, when the instance has been created for one of the super sets.

Reference by name is a semi consistent feature. Super sets are maintained properly, i.e. creating a name reference in a subset will also create a name reference in the super set, but inverse relationships are not maintained.