Use eclipselink.query-results-cache.type
to set the cache type used for the query's results cache.
Values
Table 4-33 describes this query hint's values.
Table 4-33 Valid Values for query-results-cache.type
Value | Description |
---|---|
Cache |
(Default) Fixed size LRU cache ( |
Full |
Provides full caching and guaranteed identity. |
Hard_Weak |
Similar to SOFT_WEAK, except that it uses hard references in the sub-cache. |
None |
No caching. |
Soft |
Similar to FULL, except the map holds the objects using soft references. |
Soft_Weak |
Similar to WEAK, except it maintains a most-frequently-used sub-cache. |
Weak |
Similar to FULL, except the map holds the objects using weak references. |
Usage
Examples
Example 4-67 shows how to use this hint in a JPA query.
Example 4-67 Using query-results-cache.type in a JPA Query
import org.eclipse.persistence.config.HintValues; import org.eclipse.persistence.config.QueryHints; query.setHint("eclipselink.QUERY_RESULTS_CACHE_TYPE", "FULL");
Example 4-68 shows how to use this hint with the @QueryHint
annotation.
Example 4-68 Using query-results-cache.type in a @QueryHint Annotation
import org.eclipse.persistence.config.HintValues; import org.eclipse.persistence.config.QueryHints; @QueryHint(name=QueryHints.QUERY_RESULTS_CACHE_TYPE, value="FULL");
See Also
For more information, see:
"Caching Overview"
http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Basic JPA Development/Caching/Caching Overview
"EclipseLink Caches" in the Understanding EclipseLink
"Scaling EclipseLink Applications in Clusters" in Solutions Guide for EclispeLink