ObjectDB ObjectDB

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.
Whether the cache contains data for the given entity.
Parameters:
cls - entity class
primaryKey - 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.
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.
Remove the data for the given entity from the cache.
Parameters:
cls - entity class
primaryKey - primary key
Since:
JPA 2.0
void evictAll()
Clear the cache.
Clear the cache.
Since:
JPA 2.0