Data Lookup Strategies
To get improved performance of entity lookups in cache and stores, and to make the lookup behavior more compatible with modern stores (databases), you can choose to use the key-based lookup strategy.
Key-Based Lookup Strategy
The key-based lookup strategy is enabled by default. You can set a concept or event property as primary key using the Present in Key metadata setting in the CDD in DomainObject Overrides
. You can also select more than one entity properties as Present in Key to have a composite key. You can use the Cluster.DataGrid.CacheLoadConceptByKeysByUri
or Instance.getByKeysByUri
catalog functions to load the concept.
If you do not mark an entity property as present-in-key then the extId
becomes primary key for that entity. If extId
is not provided for an entity instance, an internal extId
is automatically generated for that instance.
You can also use the key-based lookup strategy and load a concept using external key or composite key then use the following settings:
- The
Cluster.DataGrid.CacheLoadConceptByKeysByUri()
andInstance.getByKeysByUri
catalog function to load concepts using composite keys. - The Present in Key column under Properties Metadata section of the entities override (Cluster > Object Management > Domain Objects > Overrides) setting in the CDD editor.
When you use the key-based lookup strategy, the Cluster.DataGrid.
catalog functions are not available for use. You can use *ByExtId
Cluster.DataGrid.
functions instead. Also, the *ByUri
Instance.getByIdByUri
catalog function is not available. The object table is not used for store or cache lookups. Thus, in the CDD editor, the Preload Handles setting (Cluster > Object Management > Domain Objects > Overrides) is also not available.
Legacy Lookup Strategy
The legacy (object table based) lookup strategy is disabled by default.
For more details about object tables, see The Role of the Object Table.
For details about procedure to enable legacy lookup strategy, see Enabling the Legacy Lookup Strategy.
Difference Between Legacy and Key-Based Lookup Strategies
Legacy Lookup Strategy | Key-Based Lookup Strategy |
---|---|
Object Table is required to maintain index for cache and stores. | No object table is required. |
The auto generated Long Id is always the primary key. |
Concept or event properties can be made the primary key. |
Composite keys are not available for data lookups. | You can use composite keys as primary key for data lookups. |
Less compatible with modern stores. | More compatible with modern stores. |
Use of |
No such restriction. Default is |