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

Provided by Rafal Wilinski
The DynamoDBMapper class, provided by the AWS SDK for Java, provides a convenient way to map your domain classes to the items in a DynamoDB table. One of the features of the DynamoDBMapper class is the ability to perform batch delete operations. You can use the DynamoDBMapper's batchDelete method to delete multiple items in a single request in Java.
import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapperConfig; import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBScanExpression; public class BatchDeleteExample { public static void main(String[] args) { // Create a new DynamoDBMapper AmazonDynamoDB client = AmazonDynamoDBClientBuilder.standard().build(); DynamoDBMapper mapper = new DynamoDBMapper(client); // Define a scan expression to retrieve all items in the table DynamoDBScanExpression scanExpression = new DynamoDBScanExpression(); // Retrieve the items to delete List<Product> items = mapper.scan(Product.class, scanExpression); // Delete the items mapper.batchDelete(items, DynamoDBMapperConfig.DEFAULT); } }
Similar Code Examples
- Batch Get in DynamoDB Using Java
- Batch Read in DynamoDB Using Java
- Get Item Request in DynamoDB Using Java
- Batch Query in DynamoDB Using Java
- Remove with DynamoDB Mapper
- Remove Attribute in DynamoDB Using Java
- Query Date Range in DynamoDB Using Java
- Update Expression in DynamoDB Using Java
- Get All Items from DynamoDB Using Java
- Batch Load Using DynamoDB Mapper
- Delete in DynamoDB Using Java
- Conditional Update in DynamoDB Using Java
- Query Index in DynamoDB Using Java
- Update Multiple Items in DynamoDB Using Java
- Batch Write 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