Enum Class CacheStoreMode
- All Implemented Interfaces:
EntityAgent.CreationOption, EntityAgent.Option, EntityManager.CreationOption, EntityManager.Option, FetchOption, FindOption, RefreshOption, TypedQuery.Option, Serializable, Comparable<CacheStoreMode>, Constable
public enum CacheStoreMode
extends Enum<CacheStoreMode>
implements FindOption, RefreshOption, FetchOption, TypedQuery.Option, EntityManager.Option, EntityAgent.Option
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.
USEindicates that data may be written to the second-level cache.BYPASSindicates that data must not be written to the second-level cache.REFRESHindicates 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 ConstantsEnum ConstantDescriptionSpecifies 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 TypeMethodDescriptionstatic CacheStoreModeReturns the enum constant of this class with the specified name.static CacheStoreMode[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
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
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
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
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
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 nameNullPointerException- if the argument is null
-