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


exclusive-connection

Use eclipselink.exclusive-connection to specify if the query should use the exclusive (transactional/write) connection.


Values

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

Table 4-8 Valid Values for exclusive-connection

Value Description

true

The query is executed through the exclusive connection.

false




Usage

This is valid only when an EXCLUSIVE_CONNECTION_MODE property has been set for the persistence unit (such as VPD). If a jdbc.exclusive-connection.mode has been configured, use this query hint to ensure that the query is executed through the exclusive connection.

This may be required in certain cases, such as when database security prevents a query joining to a secure table from returning the correct results, when executed through the shared connection.


Examples

Example 4-17 Using exclusive-connection in a JPA Query

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

Example 4-18 Using exclusive-connection in a @QueryHint Annotation

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


See Also

For more information, see: