Use @PinnedPartitionPolicy
to pin requests to a single connection pool, allowing for vertical partitioning (that is, having an entity, query, or session always access a single database).
Annotation Elements
Table 2-49 describes this annotation's elements.
Table 2-49 @PinnedPartitioning Annotation Elements
Annotation Element | Description | Default |
---|---|---|
|
Connection pool name to which to pin queries. |
|
|
Name of the partition policy. Names must be unique for the persistence unit. |
Usage
Partition policies are globally named, to allow reuse. You must also set the partitioning policy with the @Partitioned
annotation.
You can specify @PinnedPartitioning
on an Entity, relationship, query, or session/persistence unit.
The persistence unit properties support adding named connection pools in addition to the existing configuration for read/write/sequence. A named connection pool must be defined for each node in the database cluster.
If a transaction modifies data from multiple partitions, you should use JTA ensure proper two-phase commit of the data. You can also configure an exclusive connection in the EntityManager to ensure that only a single node is used for a single transaction.
Examples
See "Using Partitioning" for an example of partitioning with EclipseLink.
See Also
For more information, see: