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


@ValuePartition

Use @ValuePartition to represent a specific value partition that will be routed to a specific connection pool.


Annotation Elements

Table 2-76 describes this annotation's elements.

Table 2-76 @ValuePartition Annotation Elements

Annotation Element Description Default

connectionPool

The connection pool to which to route queries to for the value


value

The String representation of the value




Examples

Example 2-122 shows how to use the @ValuePartition and @ValuePartitioning annotations.

Example 2-122 Using @ValuePartition Annotation

@Entity
@Table(name = "PART_EMPLOYEE")
@IdClass(EmployeePK.class)
@ValuePartitioning(
  name="ValuePartitioningByLOCATION",
  partitionColumn=@Column(name="LOCATION"),
  unionUnpartitionableQueries=true,
  defaultConnectionPool="default",
  partitions={
    @ValuePartition(connectionPool="node2", value="Ottawa"),
    @ValuePartition(connectionPool="node3", value="Toronto")
  })
@Partitioned("ValuePartitioningByLOCATION")
public class Employee implements Serializable, Cloneable {
...
}

Example 2-123 shows how to use the <partition> element in the eclipselink-orm.xml file.

Example 2-123 Using <partition> XML

<entity name="Employee" class="Employee" access="FIELD">
  <table name="PART_EMPLOYEE"/>
  <id-class class="EmployeePK"/>
  <value-partitioning name="ValuePartitioningByLOCATION" union-unpartitionable-queries="true" default-connection-pool="default">
    <partition-column name="LOCATION"/>
    <partition connection-pool="node2" value="Ottawa"/>
    <partition connection-pool="node3" value="Toronto"/>
  </value-partitioning>
<partitioned>ValuePartitioningByLOCATION</partitioned>


See Also

For more information, see: