Primary key fields¶
@PartitionKey and @ClusteringColumn are used to indicate the partition key and clustering columns. In the case of a composite partition key or multiple clustering columns, the integer value indicates the position of the column in the key:
CREATE TABLE sales(countryCode text, areaCode text, sales int,
PRIMARY KEY((countryCode, areaCode)));
@PartitionKey(0)
private String countryCode;
@PartitionKey(1)
private String areaCode;
The order of the indices must match that of the columns in the table declaration.