Get Item Request in DynamoDB Using Java (Guide w/ Code Examples)
![Rafal Wilinski](https://pbs.twimg.com/profile_images/1390706809548197895/SVCKpLNE_400x400.png)
Provided by Rafal Wilinski
You can get an item in DynamoDB using the GetItemRequest
method. It requires the table name and they primary key of the table. An implementation of this method is shown below.
import com.amazonaws.services.dynamodbv2.AmazonDynamoDB; import com.amazonaws.services.dynamodbv2.AmazonDynamoDBClientBuilder; import com.amazonaws.services.dynamodbv2.model.AttributeValue; import com.amazonaws.services.dynamodbv2.model.GetItemRequest; import com.amazonaws.services.dynamodbv2.model.GetItemResult; public class GetItemRequestExample { public static void main(String[] args) { AmazonDynamoDB client = AmazonDynamoDBClientBuilder.defaultClient(); Map<String, AttributeValue> key = new HashMap<>(); key.put("id", new AttributeValue().withN("123")); GetItemRequest request = new GetItemRequest() .withTableName("MyTable") .withKey(key); GetItemResult result = client.getItem(request); System.out.println(result.getItem()); } }
Similar Code Examples
- Insert in DynamoDB Using Java
- Remove Attribute in DynamoDB Using Java
- Remove Item in DynamoDB Using Java
- Query Local Secondary Index in DynamoDB Using Java
- Batch Delete Using DynamoDB Mapper
- Update Attribute in DynamoDB Using Java
- Query Index in DynamoDB Using Java
- Remove with DynamoDB Mapper
- Query Hash Key Only in DynamoDB Using Java
- Get in DynamoDB Using Java
- Delete Record in DynamoDB Using Java
- Query Global Secondary Index in DynamoDB Using Java
- Delete Table in DynamoDB Using Java
- Delete in DynamoDB Using Java
- Batch Insert in DynamoDB Using Java
Dynobase is a Professional GUI Client for DynamoDB
First 7 days are on us. No strings attached.
Product Features
DynamoDB Tools
DynamoDB Info
© 2024 Dynobase