Annotation Type PartitionKey


  • @Target({FIELD,METHOD})
    @Retention(RUNTIME)
    public @interface PartitionKey
    Annotates the field or getter of an 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.

    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      int value
      The position of the property in the partition key.
    • Element Detail

      • value

        int value
        The position of the property in the partition key.

        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.

        Default:
        0