Posted On: Oct 1, 2019

DynamoDBMapper, the higher-level Java interface for Amazon DynamoDB, now helps developers ensure that transactional writes are being performed on the most recent version of an item by using optimistic locking.  

DynamoDB transactions provide developers with atomic, consistent, isolated, and durable (ACID) guarantees in DynamoDB to help maintain data correctness in applications more easily. Using transactions, developers can simplify their code, and support workflows and business logic that require adding, updating, or deleting multiple items as a single, all-or-nothing operation. For example, a video game developer can use the transactional APIs to help ensure that players’ profiles are updated correctly when they exchange items in a game or make in-game purchases. Now, developers using DynamoDBMapper can implement optimistic locking for transactional API calls by using the @DynamoDBVersionAttribute annotation. The @DynamoDBVersionAttribute annotation enables developers to check the version of the item being updated by the transactional write to ensure it has not been changed by someone else since it was retrieved from the table. 

Support for transactions is available in all AWS Regions where DynamoDB is available. Pricing for transactions is based on the sizes of the items in your transactions. To get started with DynamoDB transactions, see Managing Complex Workflows with DynamoDB Transactions