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


flush

Use eclipselink.flush to specify if the query should flush the persistence context before executing.


Values

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

Table 4-9 Valid Values for flush

Value Description

true

The query triggers a flush of the persistence context before execution

false

(Default)



Usage

If the query may access objects that have been changed in the persistence context, you must trigger a flush in order for the query to see the changes. If the query does not require seeing the changes, you should avoid the flush in order to improve performance.

You can also configure the flush-mode as a persistence unit property. See "flush-clear.cache" for more information.

You can also use conforming to query changes without requiring a flush. See "cache-usage" for more information.


Examples

Example 4-19 Using flush in a JPA Query

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

Example 4-20 Using flush in a @QueryHint Annotation

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


See Also

For more information, see: