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 |
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:
"Data Partitioning"
http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Data_Partitioning
EclipseLink Examples
http://wiki.eclipse.org/EclipseLink/Examples/JPA/Partitioning