Enum Class CacheStoreMode

java.lang.Object
java.lang.Enum<CacheStoreMode>
jakarta.persistence.CacheStoreMode
All Implemented Interfaces:
EntityAgent.CreationOption, EntityAgent.Option, EntityManager.CreationOption, EntityManager.Option, FetchOption, FindOption, RefreshOption, TypedQuery.Option, Serializable, Comparable<CacheStoreMode>, Constable

Specifies how the EntityManager interacts with the second-level cache when data is read from the database and when data is written to the database.
  • USE indicates that data may be written to the second-level cache.
  • BYPASS indicates that data must not be written to the second-level cache.
  • REFRESH indicates that data must be written to the second-level cache, even when the data is already cached.

Enumerates legal values of the property jakarta.persistence.cache.storeMode.

Since:
2.0
See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from class Enum

    Enum.EnumDesc<E>
  • Enum Constant Summary

    Enum Constants
    Enum Constant
    Description
    Specifies that entity data must never be inserted into the second-level cache when read from the database, nor when written to the database.
    Specifies that entity data must be inserted or updated in the second-level cache when read from the database or when written to the database.
    Specifies that entity data may be inserted into the second-level cache when read from the database, and inserted or updated in the second-level cache when written to the database.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the enum constant of this class with the specified name.
    Returns an array containing the constants of this enum class, in the order they are declared.

    Methods inherited from class Object

    getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Details

    • USE

      public static final CacheStoreMode USE
      Specifies that entity data may be inserted into the second-level cache when read from the database, and inserted or updated in the second-level cache when written to the database. The persistence provider is not required to refresh already-cached items when reading from the database.

      This is the default mode.

    • BYPASS

      public static final CacheStoreMode BYPASS
      Specifies that entity data must never be inserted into the second-level cache when read from the database, nor when written to the database. The persistence provider is permitted to invalidate cached items when writing to the database.
      API note:
      When used as a FetchOption, this value is a hint to the persistence provider, and might be ignored.
    • REFRESH

      public static final CacheStoreMode REFRESH
      Specifies that entity data must be inserted or updated in the second-level cache when read from the database or when written to the database. The persistence provider is required to refresh already-cached items when reading from the database.
      API note:
      When used as a FetchOption, this value is a hint to the persistence provider, and might be ignored.
  • Method Details

    • values

      public static CacheStoreMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static CacheStoreMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null