Loading
Java Persistence API (JPA) Extensions Reference for EclipseLink, Release 2.4
  Go To Table Of Contents
Contents
 Search
Other Searches
 PDF
PDF
Comments
Comments


@UnionPartitioning

Use @UnionPartitioning to send queries to all connection pools and then union the results. This can be used for queries or relationships that span partitions when partitioning is used, such as on a ManyToMany cross partition relationship.


Annotation Elements

Table 2-75 describes this annotation's elements.

Table 2-75 @UnionPartitioning Annotation Elements

Annotation Element Description Default

name

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


connectionPools

List of connection pool names to load balance across

Defaults to all defined pools in the ServerSession

replicateWrite

Defines if write queries should be replicated.

Writes are normally not replicated when unioning, but can be for ManyToMany relationships, when the join table needs to be replicated.

false



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:

Comments powered by Disqus