Skip Headers

# Isolated Client Sessions

Previous

Next

An isolated client session is a special type of client session that provides its own session cache. This session cache is isolated from the shared session cache of its parent server session.

If in your TopLink project you configure all classes as isolated (see "Configuring Cache Isolation at the Project Level"), or one or more classes as isolated (see "Configuring Cache Isolation at the Descriptor Level"), then all client sessions that you acquire from a parent server session will be isolated client sessions.

Figure: Isolated Client Sessions illustrates the relationship between a parent server session's shared session cache and its child isolated client sessions.

Isolated Client Sessions

Description of "Isolated Client Sessions"

Each isolated client session owns an initially empty cache and identity maps used exclusively for isolated objects that the isolated client session accesses while it is active. The isolated client session's isolated session cache is discarded when the isolated client session is released.

When you use an isolated client session to read an isolated class, the client session reads the isolated object directly from the database and stores it in that client session's isolated session cache. When you use the client session to read a shared class, the client session reads the shared object from the parent server session's shared session cache. If the shared object is not in the parent server session's shared session cache, it will read it from the database and store it in the parent server session's shared session cache.

Isolated objects in an isolated client session's isolated session cache may reference shared objects in the parent server session's shared session cache, but shared objects in the parent server session's shared session cache cannot reference isolated objects in an isolated client session's isolated session cache.

Note: You cannot define mappings from shared classes to isolated classes. If using CMP, you also cannot define references from isolated enterprise beans to shared EJB.

Client sessions can access the data source using a connection pool, or an exclusive connection. To use an exclusive connection, acquire the isolated client session using a `ConnectionPolicy` (see "Acquiring a Client Session That Uses Exclusive Connections"). Using an exclusive connection provides improved user-based security for reads and writes. Named queries can also use an exclusive connection (see "Configuring Named Query Advanced Options").

Note: If an isolated session contains an exclusive connection, you must release the session when you are finished using it. Relying on the finalizer to release the connection when the session is garbage collected may cause errors when dealing with Java Transaction API (JTA) transactions.

Use isolated client sessions to do the following:

- avoid caching highly volatile data in the shared session cache

- achieve serializable transaction isolation (see "Isolated Client Session Cache")

- use the Oracle Virtual Private Database (VPD) feature in your TopLink-enabled application (see "Isolated Client Sessions and Oracle Virtual Private Database (VPD)")

For more information, see the following:

- "Isolated Client Session Limitations"

- "Acquiring an Isolated Client Session"

- "Configuring Exclusive Isolated Client Sessions for Virtual Private Database"