Skip Headers

# Using Java

Previous

Next

To configure whether or not an exclusive connection is allocated to a particular isolated session, use `ConnectionPolicy` method `setShouldUseExclusiveConnection`.

To define a map of properties used to support an isolated session, use the following `ConnectionPolicy` methods:

- `setProperty(Object key, Object value)`: Adds the property `value` to the `Map` under `key`, overwriting the existing value if `key` already exists in the `Map`.

- `Object getProperty(Object key)`: Returns the value associated with `key` as an `Object`.

- `boolean hasProperties`: Returns `true` if one or more properties exist in the `Map`; otherwise returns false.

The TopLink runtime passes this `Map` into `SessionEvent` events `PostAcquireExclusiveConnection` and `PreReleaseExclusiveConnection` so that your implementation can make the appropriate PL/SQL calls to the underlying database platform (see "PostAcquireExclusiveConnection Event Handler" and "PreReleaseExclusiveConnection Event Handler").

To configure the session to use a named connection pool, use the `ConnectionPool` constructor that takes a `String` connection pool name as an argument:

    Session clientSession = server.acquireClientSession(
        new ConnectionPolicy("myConnectionPool")
    );