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


Use @Partitioning to configure a custom PartitioningPolicy.

Annotation Elements

Table 2-48 describes this annotation's elements.

Table 2-48 @Partitioning Annotation Elements

Annotation Element Description Default


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


(Required) Full package.class name of a subclass of PartitioningPolicy.


Data partitioning allows for an application to scale its data across more than a single database machine. EclipseLink supports data partitioning at the Entity level to allow a different set of entity instances for the same class to be stored in a different physical database or different node within a database cluster. Both regular databases and clustered databases are supported. Data can be partitioned both horizontally and vertically.

Partitioning can be enabled on an entity, a relationship, a query, or a persistence unit.


Example 2-89 shows a custom partitioning policy.

Example 2-89 Using @Partitioning Annotation

@Partitioning(name="order", partitioningClass=OrderPartitioningPolicy.class)
@public class Order {
public class OrderPartitioningPolicy extends PartitioningPolicy {
    public List<Accessor> getConnectionsForQuery(AbstractSession session, DatabaseQuery query, AbstractRecord arguments) {
        List<Accessor> accessors = new ArrayList<Accessor>(1);
        accessors.add(getAccessor(ACMEPool.leastBusy(), session, query, false));
        return accessors;

See Also

For more information, see: