Jakarta Persistence (JPA) Interface
jakarta.persistence.Cache
Interface used to interact with the second-level cache. If no second-level cache is in use, the methods of this interface have no effect, except for
contains, which returns false.- Since:
- Jakarta Persistence (JPA) 2.0
The Shared (L2) Entity Cache article explains how to use
Cache.Public Instance Methods
- Parameters:
cls- entity classprimaryKey- primary key
- Returns:
- boolean indicating whether the entity is in the cache.
- Since:
- Jakarta Persistence (JPA) 1.0
- Parameters:
cls- entity classprimaryKey- primary key
- Since:
- Jakarta Persistence (JPA) 1.0
- Parameters:
cls- entity class
- Since:
- Jakarta Persistence (JPA) 1.0
void evictAll()- Since:
- Jakarta Persistence (JPA) 1.0
If the provider's implementation of the
Cache interface does not support the specified class, the PersistenceException is thrown.- Parameters:
cls- the class of the object to be returned. This is usually either the underlying class implementingCache, or an interface it implements.
- Returns:
- an instance of the specified type.
- Throws:
- if the provider does not support the given type.PersistenceException
- Since:
- Jakarta Persistence (JPA) 2.1