Use eclipselink.jdbc.exclusive-connection.mode to specify when TopLink performs reads through the write connection.
Table 5-45 describes this persistence property's values.
Table 5-45 Valid Values for jdbc.exclusive-connection.mode
| Value | Description |
|---|---|
|
|
(Default) Create an isolated client session if some or all entities require isolated cache, otherwise create a client session. Notes:
|
|
|
Create an exclusive isolated client session if reading an isolated entity, otherwise raise an error. Notes:
|
|
|
Create an exclusive isolated client session if reading an isolated entity, otherwise create an exclusive client session. Note: TopLink keeps the connection exclusive for the lifetime of the owning |
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.
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");
For more information, see:
"Isolated Client Sessions" in Understanding Oracle TopLink
"Connections" in Understanding Oracle TopLink