company logo

Temporary collections

Keywords:  persistence type

Temporary collection are used for storing view results or a result collection created by the application for a longer period in an application. Temporary collections need less memory but are are not as fast as transient collections. In contrast to transient collections, temporary collections are used for storing large result sets. Temporary collections are the most efficient way for random access on large result collections.

Temporary collections or extents are references being defined globally as extent. For defining a temporary collection, the transient option and the create option must be switched on. Temporary collections must have got at least one index definition.

In contrast to transient collections, temporary collections are stored to a temporary database. Temporary collections must be filled by the application (e.g. in the open handler of an appropriate context class) or may refer to a source definition (view), which is automatically executed when opening the collection.

Temporary collections can be opened as temporary extents, when the controlled option is switched on. In this case, the temporary extent can be accessed from any property handle opened for the extent in the application. The extent will be removed when closing the database object or database handle for which the extent has been opened. Temporary extents are created, when the first property handle referring to the temporary extent is opened.

Extents not being defined as controlled are defined for the property handle opened, only, and will be removed when deleting the property handle. This is a simple way of referring to predefined queries.

When no source has been defined for a temporary collection, the collection must be filled by the application. When a source is defined, the collection is calculated from the source when opening a temporary extent or when initializing the reference after reading its parent instance.

Subordinated temporary collections with source definition are calculated after reading the parent instance, only, when being accessed directly (e.g. calling count() or get() for the temporary collection). The first access to the temporary collection causes the system to calculate the collection completely, which may take some time.