Annotation Type SortKey
Marks the sort key of a two-column composite identifier, for a document store.
A DynamoDB table is keyed by a partition key and, optionally, a sort key; the
items of one partition are stored in sort-key order and read together. An
entity says which identifier column is which by marking one of exactly two
@Id columns (or two components of an @EmbeddedId) with this annotation;
the other is the partition key. MongoDB stores the pair as a compound _id.
@Entity
public class Message {
@Id(autoIncrement = false) String channel;
@Id(autoIncrement = false) @SortKey long sentAt;
String text;
}
A SQL session ignores it: the pair is the table's composite primary key there.