IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

com.ibm.websphere.objectgrid.plugins.io.annotations
Annotation Type PartitionKey


@Target(value={TYPE,FIELD})
@Retention(value=RUNTIME)
public @interface PartitionKey

Specifies a single attribute to use to calculate the partition hash code.

(Note: this annotation is currently only used when eXtreme scale data format (XDF) is enabled)
The @PartitionKey annotation can be specified for the class using a path syntax to identify a single attribute. Multiple attributes can be specified using additional @PartitionKey annotations on each field, using the order() attribute to specify the order in which the hash codes will be calculated.

The PartitionKey is not inheritable.

Use the PartitionKeys annotation to specify more complex attribute combinations at the class level.

The following examples illustrate how to identify a top-level, primitive field:
Simple class annotation example:

 @PartitionKey("deptId")
 class Employee {
     int empId;
     int deptId;
 }
 
Simple field annotation example:
 class Employee {
     int empId;

     @PartitionKey
     int deptId;
 }
 
Simple, multiple field annotation example:
 class Employee {
     int empId;

     @PartitionKey(order=0)
     int deptId;

     @PartitionKey(order=1)
     String country;
 }
 
The following examples illustrate how to address an attribute inside an embedded class. In this case, the path separator is defined in the data grid as a "." character:
Embedded class annotation example:
 @PartitionKey("deptKey.id")
 class Employee {
     DepartmentKey deptKey;
 }

 class DepartmentKey {
     int id;
 }
 
Embedded field annotation example:
 class Employee {
     @PartitionKey("id")
     DepartmentKey deptKey;
 }

 class DepartmentKey {
     int id;
 }
 

Since:
8.6

Optional Element Summary
 short order
          Order of the fields that contribute to the partition calculation.
 String value
          Identifies the path to the attribute that should be included as part of the partition key.
 

value

public abstract String value
Identifies the path to the attribute that should be included as part of the partition key.

Returns:
the attribute path.
Default:
""

order

public abstract short order
Order of the fields that contribute to the partition calculation.

Returns:
the field order
Default:
0

IBM WebSphereTM eXtreme Scale, Release 8.6
API Specification

© Copyright International Business Machines Corp 2005,2012. All rights reserved.