Skip Headers

# Sequence Connection Pool s

Previous

Next

An essential part of maintaining object identity (see "Cache Type and Object Identity") is sequencing–managing the assignment of unique values to distinguish one instance from another. For more information, see "Projects and Sequencing".

Sequencing involves reading and writing a special sequence resource maintained by your data source.

By default, TopLink includes sequence operations in a separate transaction. This avoids complications during the write transaction, which may lead to deadlocks over the sequence resource. However, when using an external transaction controller (such as a JTA data source or connection pool), TopLink cannot use a different transaction for sequencing. Use a sequence connection pool to configure a non-JTA transaction pool for sequencing. This is required only for table sequencing–not native sequencing.

In each server session, you can create one connection pool, called a sequence connection pool, that TopLink uses exclusively for sequencing. With a sequence connection pool, TopLink satisfies a request for a new object identifier outside of the transaction from which the request originates. This allows TopLink to immediately commit an update to the sequence resource, which avoids deadlocks.

Note: If you use a sequence connection pool and the original transaction fails, the sequence operation does not roll back.

You should use a sequence connection pool, if the following applies:

- You use table sequencing (that is, non-native sequencing). See "Table Sequencing" and "Unary Table Sequencing" for more information.

- You use external transaction controller (JTA).

You should not use a sequence connection pool, if the following applies:

- You do not use sequencing, or use the data source's native sequencing (see "Native Sequencing With an Oracle Database Platform" and "Native Sequencing With a Non-Oracle Database Platform").

- You have configured the sequence table to avoid deadlocks.

- You use non-JTA data sources.

For more information, see

- "Internal Connection Pool Creation Overview"

- "Internal Connection Pool Configuration Overview"