Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents
 Search
 PDFComments
Comments


jdbc.cache-statement

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

true

The query will cache its JDBC statement.

false

(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 DataSource, you must set statement caching in the DataSource configuration.



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: