@Target(value={FIELD,METHOD}) @Retention(value=RUNTIME) public @interface PartitionKey
Entity
property, to indicate that it's part of the
partition key.
Example:
@PartitionKey private UUID id;This information is used by the mapper processor to generate default queries (for example a basic
Select
). Note that an entity is not required to have a partition key, for example if it
only gets mapped as a UDT.
If the partition key is composite, you must specify value()
to indicate the position
of each property:
@PartitionKey(1) private int pk1; @PartitionKey(2) private int pk2;If you don't specify positions, or if there are duplicates, the mapper processor will issue a compile-time error.
This annotation is mutually exclusive with ClusteringColumn
.
Modifier and Type | Optional Element and Description |
---|---|
int |
value
The position of the property in the partition key.
|
public abstract int value
This is only required if the partition key is composite. Positions are not strictly required to be consecutive or start at a given index, but for clarity it is recommended to use consecutive integers.
Copyright © 2017–2022. All rights reserved.