EntityManager interacts with the second-level cache when data is read from the database and when data is written to the database.">
Jakarta Persistence (JPA) Enum

jakarta.persistence.CacheStoreMode

java.lang.Object
  java.lang.Enum<jakarta.persistence.CacheStoreMode>
    jakarta.persistence.CacheStoreMode
Implemented Interfaces:
FindOption, RefreshOption, Constable, Comparable<E>, Serializable

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 may 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.

See Also:
Since:
Jakarta Persistence (JPA) 2.0
The Shared (L2) Entity Cache article explains how to use CacheStoreMode.

Enum Constants

Don't insert into cache.
Since:
Jakarta Persistence (JPA) 1.0
Insert/update entity data held in the cache when read from the database and when written to the database.
Force refresh of cache for items read from database.
Since:
Jakarta Persistence (JPA) 1.0
Insert entity data into cache when read from database and insert/update entity data when written to the database: this is the default behavior.
Does not force refresh of already cached items when reading from database.
Since:
Jakarta Persistence (JPA) 1.0

Synthetic Public Static Methods:

values(), valueOf(String)

Additional JDK methods inherited from java.lang.Enum

clone(), compareTo(E), describeConstable(), equals(Object), finalize(), getDeclaringClass(), hashCode(), name(), ordinal(), readObject(ObjectInputStream), readObjectNoData(), toString(), valueOf(Class,String)

Additional JDK methods inherited from java.lang.Object

clone(), equals(Object), finalize(), getClass(), hashCode(), notify(), notifyAll(), toString(), wait(), wait(long), wait(long,int), wait0(long)

Additional JDK methods inherited from java.lang.constant.Constable

describeConstable()

Additional JDK methods inherited from java.lang.Comparable

compareTo(T)