Use eclipselink.query-results-cache.type
to set the cache type used for the query's results cache.
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. |
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");
For more information, see:
"Oracle TopLink Caches" in the Understanding Oracle TopLink
"Scaling Oracle TopLink Applications in Clusters" in Solutions Guide for Oracle TopLink