Top Description Fields Constructors Methods
org.eclipse.persistence.config

public Class CacheUsage

extends Object
Class Inheritance

Cache usage hint values. Cache usage allows the cache to be used on queries to avoid accessing the database. By default for JPA queries the cache is not checked before accessing the database, but is used after accessing the database to avoid re-building the objects and avoid accessing the database for relationships. Cache usage can also be used for modify Update-All and Delete-All queries. For modify-all queries it effects how the cache is updated, either NoCache or Invalidate. By default modify-all queries invalidate the cache. The class contains all the valid values for QueryHints.CACHE_USAGE query hint.

JPA Query Hint Usage:

query.setHint(QueryHints.CACHE_USAGE, CacheUsage.CheckCacheOnly);

or

@QueryHint(name=QueryHints.CACHE_USAGE, value=CacheUsage.CheckCacheOnly)

Hint values are case-insensitive. "" could be used instead of default value CacheUsage.DEFAULT.

See Also
QueryHints

Field Summary

Modifier and TypeField and Description
public static final String
CheckCacheByExactPrimaryKey

Configure the cache to be checked first if the query is by primary key (only).

public static final String
CheckCacheByPrimaryKey

Configure the cache to be checked first if the query contains the primary key.

public static final String
CheckCacheOnly

Configure the cache to be searched for any matching objects.

public static final String
CheckCacheThenDatabase

Configure the cache to be searched for any matching object before accesing the database.

public static final String
ConformResultsInUnitOfWork

Configure the query results to be conformed with the current persistence context.

public static final String
public static final String
DoNotCheckCache

Do not check the cache first, this is the default for JPA Queries.

public static final String
Invalidate

Configures a modify-all query to invalidate the cache.

public static final String
NoCache

Configures a modify-all query to not invalidate the cache.

public static final String
UseEntityDefault

By default the descriptor default is used, which is to not check the cache first.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CheckCacheByExactPrimaryKeyback to summary
public static final String CheckCacheByExactPrimaryKey

Configure the cache to be checked first if the query is by primary key (only). This can only be used on queries that return a single entity.

CheckCacheByPrimaryKeyback to summary
public static final String CheckCacheByPrimaryKey

Configure the cache to be checked first if the query contains the primary key. This can only be used on queries that return a single entity.

CheckCacheOnlyback to summary
public static final String CheckCacheOnly

Configure the cache to be searched for any matching objects. Any objects not currently in the cache will not be returned. This can only be used on queries that return a single set of entities.

CheckCacheThenDatabaseback to summary
public static final String CheckCacheThenDatabase

Configure the cache to be searched for any matching object before accesing the database. This can only be used on queries that return a single entity.

ConformResultsInUnitOfWorkback to summary
public static final String ConformResultsInUnitOfWork

Configure the query results to be conformed with the current persistence context. This allows non-flushed changes to be included in the query. This can only be used on queries that return a single set of entities.

DEFAULTback to summary
public static final String DEFAULT
DoNotCheckCacheback to summary
public static final String DoNotCheckCache

Do not check the cache first, this is the default for JPA Queries.

Invalidateback to summary
public static final String Invalidate

Configures a modify-all query to invalidate the cache.

NoCacheback to summary
public static final String NoCache

Configures a modify-all query to not invalidate the cache.

UseEntityDefaultback to summary
public static final String UseEntityDefault

By default the descriptor default is used, which is to not check the cache first.

Constructor Detail

CacheUsageback to summary
public CacheUsage()