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


prepare

Use eclipselink.prepare to specify if a query prepares (that is, generates) its SQL for each execution.


Values

Table 4-26 describes this query hint's values.

Table 4-26 Valid Values for prepare

Value Description

true

Generate the SQL each time EclipseLink executes the query.

false

(Default) Generate the SQL only the first time EclipseLink executes the query.



Usage

By default, EclipseLink does not re-generate the SQL for each execution. This may improve performance.

For queries that require dynamic SQL (for example, to handle null parameters) set eclipselink.prepare to false.


Examples

Example 4-52 Using prepare in a JPA Query

import org.eclipse.persistence.config.HintValues;
 import org.eclipse.persistence.config.QueryHints;
 query.setHint("eclipselink.PREPARE", "TRUE");

Example 4-53 Using prepare in a @QueryHint Annotation

import org.eclipse.persistence.config.HintValues;
 import org.eclipse.persistence.config.QueryHints;
 @QueryHint(name=QueryHints.PREPARE, value="TRUE");


See Also

For more information, see: