An index on a single field.
An index on two fields.
An index on three fields.
An index on a four fields.
Indexes provide fast lookup of objects based on field value(s). The
Index* interfaces in this package have
generic type parameters that correspond to the field value type(s), plus a final generic type parameter
corresponding to the "target type". For example, an index on field
getAccountNumber() of type
User will be represented by a
<Integer, User>, and may be viewed
either as a
Indexes are accessible through the
JTransaction.queryIndex()- Access the index associated with a simple field
JTransaction.queryListElementIndex()- Access the composite index associated with a list field that includes corresponding list indices
JTransaction.queryMapValueIndex()- Access the composite index associated with a map value field that includes corresponding map keys
JTransaction.queryCompositeIndex()- Access a composite index defined on two fields
JTransaction.queryCompositeIndex()- Access a composite index defined on three fields
JTransaction.queryCompositeIndex()- Access a composite index defined on four fields
JTransaction.queryVersion()- Get database objects grouped according to their schema versions
Simple and Composite Indexes
A simple index on a single field value is created by setting
indexed="true" on the
Composite indexes on multiple fields are also supported. These are useful when the target type needs to be sorted
on multiple fields; for simple searching on multiple fields, it suffices to have independent, single-field indexes,
which can be intersected via
A composite index on two fields
String getUsername() and
float getBalance() of type
will be represented by a
<String, Float, User>; a composite index on
three fields of type
Z by a
<X, Y, Z, User>, etc.
A composite index may be viewed as a set of tuples of indexed and target values, or as various mappings from one
or more indexed field values to subsequent values. A composite index may also be viewed as a simpler index on
any prefix of the indexed fields; for example, see
Only simple fields may be indexed, but the indexed field can be either a normal object field or a sub-field of
Map field. However,
complex sub-fields may not appear in composite indexes.
For those complex sub-fields that can contain duplicate values (namely,
List element and
Map value), the associated distinguishing value (respectively,
Map key) is appended to the index and becomes the new target type.
Therefore the resulting index types associated with indexes on complex sub-fields are as follows:
Copyright © 2020. All rights reserved.