Specify if the query caches its JDBC statement.
Values
Table 4-14 describes this query hint's values.
Table 4-14 Valid Values for jdbc.cache-statement
Value | Description |
---|---|
|
The query will cache its JDBC statement. |
|
(Default) |
Usage
This allows queries to use parameterized SQL with statement caching. It also allows a specific query to not cache its statement, if statement caching is enable for the persistence unit.
Tip: Normally, you should set statement caching for the entire persistence unit (see "jdbc.cache-statements") instead of each query. When using a |
Examples
Example 4-30 Using jdbc.cache-statement in a JPA Query
import org.eclipse.persistence.config.HintValues; import org.eclipse.persistence.config.QueryHints; query.setHint("eclipselink.CACHE_STATEMENT", "TRUE");
Example 4-31 Using jdbc.cache-statement in a @QueryHint Annotation
import org.eclipse.persistence.config.HintValues; import org.eclipse.persistence.config.QueryHints; @QueryHint(name=QueryHints.CACHE_STATEMENT, value="TRUE");
See Also
For more information, see:
"Enhancing Performance" in Solutions Guide for EclispeLink