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


@Partitioning

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

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


partitioningClass

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




Usage

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.


Examples

Example 2-89 shows a custom partitioning policy.

Example 2-89 Using @Partitioning Annotation

@Entity
@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:

Comments powered by Disqus