ScyllaDB Java Driver is available under the Apache v2 License. ScyllaDB Java Driver is a fork of DataStax Java Driver. See Copyright here.
Primary key columns¶
If the entity maps to a table, properties that map to partition key columns must be annotated with @PartitionKey:
// CREATE TABLE sales(countryCode text, areaCode text, sales int,
// PRIMARY KEY((countryCode, areaCode)));
@PartitionKey(1)
private String countryCode;
@PartitionKey(2)
private String areaCode;
If the partition key is composite, the annotation’s integer value indicates the position of each property in the key. Note that any values can be used, but for clarity it’s probably a good idea to use consecutive integers starting at 0 or 1.
Similarly, properties that map to clustering columns must be annotated with @ClusteringColumn:
// CREATE TABLE sensor_reading(id uuid, year int, month int, day int, value double,
// PRIMARY KEY(id, year, month, day));
@PartitionKey
private UUID id;
@ClusteringColumn(1)
private int year;
@ClusteringColumn(2)
private int month;
@ClusteringColumn(3)
private int day;
This information is used by some of the DAO method annotations; for example, @Select’s default behavior is to generate a selection by primary key.