Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.5
  Go To Table Of Contents
 Search
 PDFComments
Comments


@RoundRobinPartitioning

Use @RoundRobinPartitioning to send requests in a "round robin" fashion to the set of connection pools.


Annotation Elements

Table 2-62 describes this annotation's elements.

Table 2-62 @RoundRobinPartitioning Annotation Elements

Annotation Element Description Default

name

(Required) Name of the partition policy. Names must be unique for the persistence unit.


connectionPools

(Optional) List of connection pool names to load balance across.

All defined pools in the ServerSession

replicateWrite

(Optional) This allows for a set of database to be written to and kept in sync, and have reads load-balanced across the databases.

false



Usage

Use the @RoundRobinPartitioning annotation for load-balancing read queries across a cluster of database machines. Using @RoundRobinPartitioning requires that the full database be replicated on each machine.

The data should either be read-only, or writes should be replicated on the database.

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 "@Partitioned" for an example of partitioning with EclipseLink.


See Also

For more information, see: