Use @ReplicationPartitioning
to send requests to a set of connection pools. It is for replicating data across a cluster of database machines. Only modification queries are replicated.
Annotation Elements
Table 2-60 describes this annotation's elements.
Table 2-60 @ReplicationPartitioning Annotation Elements
Annotation Element | Description | Default |
---|---|---|
|
The name of the partition policy; must be unique for the persistence unit. |
|
|
List of connection pool names to replicate across. |
All defined pools in the |
Usage
Partitioning can be enabled on an Entity, relationship, query, or session/persistence unit.
Partition policies are globally named to allow reuse, the partitioning policy must also be set using the @Partitioned
annotation to be used.
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: