Batch Update Using DynamoDB Mapper (Guide w/ Code Examples)

Provided by Rafal Wilinski
DynamoDBMapper class, does not have a specific method for batch update like "batchUpdate" method. However, you can use the save method in a loop to update multiple items one by one. In this example, a list of items to update is defined, and the save method is called for each item in the list. The savemethod accepts an instance of the domain class object, and it works by checking the primary key value, if the primary key value is present in the item, the item will be updated, if not, a new item will be created.
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper; import java.util.List; public class BatchUpdateExample { public static void main(String[] args) { // Create a new DynamoDBMapper AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard().build(); DynamoDBMapper mapper = new DynamoDBMapper(client); // Define a list of items to update List<Product> itemsToUpdate = new ArrayList<Product>(); itemsToUpdate.add(new Product("111", "Updated Product 1", 50, 20)); itemsToUpdate.add(new Product("222", "Updated Product 2", 100, 30)); itemsToUpdate.add(new Product("333", "Updated Product 3", 150, 40)); for (Product item : itemsToUpdate) { // Update the item mapper.save(item); } } }
Similar Code Examples
- Remove Attribute in DynamoDB Using Java
- Batch Delete Using DynamoDB Mapper
- Delete All Items in DynamoDB Using Java
- Batch Read in DynamoDB Using Java
- Query Local Secondary Index in DynamoDB Using Java
- Delete in DynamoDB Using Java
- Get Item Request in DynamoDB Using Java
- Update Attribute in DynamoDB Using Java
- Batch Write Using DynamoDB Mapper
- Remove Item in DynamoDB Using Java
- Update Multiple Items in DynamoDB Using Java
- Update Item in DynamoDB Using Java
- Batch Load Using DynamoDB Mapper
- Batch Write Item in DynamoDB Using Java
- Delete by Hashkey Using DynamoDB Mapper
Dynobase is a Professional GUI Client for DynamoDB
Start your 7-day free trial today
Product Features
- New in Dynobase 3.0
- Semantic and Vector Search
- Schema Explorer
- Visual JSON Path Filtering
- Visual Item Diff
- MCP Server for AI Tools
- Use SQL with DynamoDB
- Import CSV To DynamoDB
- Import JSON To DynamoDB
- Export DynamoDB To JSON
- Export DynamoDB To S3
- Export DynamoDB To CSV
- DynamoDB Update Item
- DynamoDB Delete All Items
- DynamoDB Delete Item
- DynamoDB Create Table
- DynamoDB Delete Table
- DynamoDB Conditional Update
DynamoDB Tools
DynamoDB Info
© 2026 Dynobase