EntityManager interacts with the second-level cache when data is read from the database via the EntityManager.find methods and execution of queries.">
Jakarta Persistence (JPA) Enum

jakarta.persistence.CacheRetrieveMode

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

Specifies how the EntityManager interacts with the second-level cache when data is read from the database via the EntityManager.find methods and execution of queries.
  • USE indicates that data may be read from the second-level cache.
  • BYPASS indicates that data may not be read from the second-level cache.

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

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

Enum Constants

Bypass the cache: get data directly from the database.
Since:
Jakarta Persistence (JPA) 1.0
Read entity data from the cache: this is the default behavior.
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)