Module eclipselink

Annotation Interface CacheIndex


Allow a cache index to be defined. A cache index allows singleResult queries to obtain a cache hit when querying on the indexed fields. resultList queries cannot obtain cache hits, as it is unknown if all the objects are in memory, (unless the cache usage query hint is used).

The index should be unique, but if not unique, the first indexed object will be returned. Cache indexes are only relevant when caching is enabled.

The CacheIndex can be defined on an Entity class, or on an attribute. The column is defaulted when defined on an attribute.

Author:
James Sutherland
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Specify the set of columns to define the index on.
    boolean
    Specify if the indexed field is updateable.
  • Element Details

    • columnNames

      String[] columnNames
      Specify the set of columns to define the index on.

      Not required when annotated on a field/method.

      Default:
      {}
    • updateable

      boolean updateable
      Specify if the indexed field is updateable.

      If updateable the object will be re-indexed on each update/refresh.

      Default:
      true