Annotation Type DynamoDbVersionAttribute


@SdkPublicApi @Target(METHOD) @Retention(RUNTIME) public @interface DynamoDbVersionAttribute
Denotes this attribute as recording the version record number to be used for optimistic locking. Every time a record with this attribute is written to the database it will be incremented and a condition added to the request to check for an exact match of the old version.

Version Calculation: The first version written to a new record is calculated as startAt + incrementBy. For example, with startAt=0 and incrementBy=1 (defaults), the first version is 1. To start versioning from 0, use startAt=-1 and incrementBy=1, which produces first version = 0.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    long
    The amount to increment the version by with each update.
    long
    The starting value for the version attribute.
  • Element Details

    • startAt

      long startAt
      The starting value for the version attribute. Default value - 0.
      Returns:
      the starting value
      Default:
      0L
    • incrementBy

      long incrementBy
      The amount to increment the version by with each update. Default value - 1.
      Returns:
      the increment value
      Default:
      1L