The query SQL cache is a Map
used to cache
pushed-down SQL query strings for the find operation. As a result,
the SQL queries are only generated once in OpenJPA, and cached thereafter.
This query SQL cache is shared across entity managers and the fetch plan
is part of the cache key. You can control the SQL cache through
the
openjpa.jdbc.QuerySQLCache
configuration property. This
property accepts a plugin string (see Section 4, “
Plugin Configuration
”)
describing the Map
used to associate query strings and
their parsed form. This property accepts the following aliases:
Table 10.3. Pre-defined aliases
Alias | Value | Notes |
---|---|---|
true
|
org.apache.openjpa.util.CacheMap
|
The default option. Uses a
CacheMap to store sql string.
CacheMap maintains a fixed number of cache entries, and an
optional soft reference map for entries that are moved out of the LRU space.
So, for applications that have a monotonically increasing number of distinct
queries, this option can be used to ensure that a fixed amount of memory is
used by the cache.
|
all |
org.apache.openjpa.lib.util.ConcurrentHashMap
| This is the fastest option, but sql string is never dropped from the cache, so if you use a large number of dynamic queries, this option may result in ever-increasing memory usage. Note that if your queries only differ in the values of the parameters, this should not be an issue. |
false | none | Disables the sql cache. |