Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents
 Search
 PDFComments
Comments


query-results-cache.size

Use eclipselink.query-results-cache.size to set the fixed size of the query's results cache.


Values

Table 4-32 describes this query hint's values.

Table 4-32 Valid Values for query-results-cache.size

Value Description

Size

Integer or Strings that can be parsed to int values
(Default: 100)



Usage

When using query-results-cache, if the same named query with the same arguments is re-executed EclipseLink will skip the database and return the cached results.


NoteNote:

If a query has no arguments, use a size of 1 (as there is only a single result).



Examples

Example 4-65 Using query-results-cache.size in a JPA Query

import org.eclipse.persistence.config.HintValues;
 import org.eclipse.persistence.config.QueryHints;
 query.setHint("eclipselink.QUERY_RESULTS_CACHE_SIZE", "150");

Example 4-66 Using query-results-cache.size in a @QueryHint Annotation

import org.eclipse.persistence.config.HintValues;
 import org.eclipse.persistence.config.QueryHints;
 @QueryHint(name=QueryHints.QUERY_RESULTS_CACHE_SIZE, value="150");


See Also

For more information, see: