javax.persistence.Cache - JPA interface
javax.persistence
Interface Cache
Interface used to interact with the second-level cache. If a cache is not in use, the methods of this interface have no effect, except for
contains
, which returns false. - Since:
- JPA 2.0
Learn how to use Cache in Chapter 3 of the ObjectDB/JPA manual.
boolean contains(Class cls, Object primaryKey)
Whether the cache contains data for the given entity.
- Parameters:
-
cls
- entity classprimaryKey
- primary key
- Returns:
- boolean indicating whether the entity is in the cache
- Since:
- JPA 2.0
void evict(Class cls)
Remove the data for entities of the specified class (and its subclasses) from the cache.
- Parameters:
-
cls
- entity class
- Since:
- JPA 2.0
void evict(Class cls, Object primaryKey)
Remove the data for the given entity from the cache.
- Parameters:
-
cls
- entity classprimaryKey
- primary key
- Since:
- JPA 2.0
void evictAll()
Clear the cache.
- Since:
- JPA 2.0