Jump to: navigation, search

EclipseLink/UserGuide/JPA/Basic JPA Development/Caching/Query Options

< EclipseLink‎ | UserGuide‎ | JPA‎ | Basic JPA Development‎ | Caching
Revision as of 10:39, 29 May 2012 by James.sutherland.oracle.com (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

EclipseLink JPA

link="http://wiki.eclipse.org/EclipseLink"
EclipseLink
Website
Download
Community
Mailing ListForumsIRC
Bugzilla
Open
Help Wanted
Bug Day
Contribute
Browse Source

Elug api package icon.png Key API

Query Options and In-memory Querying

The EclipseLink query results cache allows the results of named queries to be cached, similar to how objects are cached.

Configuring Query Results Cache

The query results cache is configured through query hints.

Query Results Cache Query Hints
Hint Description Default Required?
eclipselink.query-results-cache Enable query results cache for the named query. no cached results Required
eclipselink.query-results-cache.size Sets the fixed size of the query results cache for the named query. The size is the number of queries with unique parameters to cache. If the query has no parameters, a value of 1 should be used. 100 Optional
eclipselink.query-results-cache.expiry Sets the expiry time in milliseconds of the cached results. no expiry Optional
eclipselink.query-results-cache.expiry-time-of-day Configures the time of day expiry. Valid values are string time format, "HH:MM:SS". no expiry Optional
eclipselink.query-results-cache.randomize-expiry Set if the expiry time should be randomized by 10% of the set expiry time. This can be used to avoid a bottleneck on a fixed expiry time. false Optional
eclipselink.query-results-cache.type Set the cache type. Valid values are defined in the CacheType enum. Normally an LRU fixed sized CACHE is used, a FULL, WEAK or SOFT cache can also be used. CACHE Optional
In-memory query example
Query query = em.createQuery("Select e from Employee e where e.firstName like :firstName and e.lastName like :lastName");
query.setParameter("firstName", "B%");
query.setParameter("lastName", "S%");
List<Employee> employees = query.getResultList();

Eclipselink-logo.gif
Version: 2.4 DRAFT
Other versions...