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


jdbc.exclusive-connection.mode

Use eclipselink.jdbc.exclusive-connection.mode to specify when EclipseLink performs reads through the write connection.


Values

Table 5-45 describes this persistence property's values.

Table 5-45 Valid Values for jdbc.exclusive-connection.mode

Value Description

Transactional

(Default) Create an isolated client session if some or all entities require isolated cache, otherwise create a client session.

Notes:

  • EclipseLink keeps the connection exclusive for the duration of the transaction.

  • Inside the transaction, EclipseLink performs all writes and reads through the exclusive connection.

  • Outside the EclipseLink transaction, a new connection is acquired from the connection pool for each read and released back immediately after the query is executed.

Isolated

Create an exclusive isolated client session if reading an isolated entity, otherwise raise an error.

Notes:

  • EclipseLink keeps the connection exclusive for the lifetime of the owning EntityManager.

  • Inside the transaction, EclipseLink performs all writes and reads through the exclusive connection.

  • Outside the EclipseLink transaction, only isolated entities are read through the exclusive connection. For non-isolated entities, EclipseLink acquires a new connection from the connection pool for each read and immediately releases the connection after executing the query.

Always

Create an exclusive isolated client session if reading an isolated entity, otherwise create an exclusive client session.

Note: EclipseLink keeps the connection exclusive for the lifetime of the owning EntityManager and performs all writes and reads through the exclusive connection.



Usage

You can set this property while creating either an EntityManagerFactory (either in the map passed to the createEntityManagerFactory method, or in the persistence.xml file), or an EntityManager (in the map passed to the createEntityManager method). Note that the latter overrides the former.


Examples

Example 5-40 Using jdbc.exclusive-connection.mode in persitence.xml

property name="eclipselink.jdbc.exclusive-connection.mode" value="Always"/>
 

Example 5-41 Using jdbc.exclusive-connection.mode in Property Map

import org.eclipse.persistence.config.PersistenceUnitProperties;
propertiesMap.put(PersistenceUnitProperties.EXCLUSIVE_CONNECTION_MODE, "Always");


See Also

For more information, see: