Amazon DynamoDB
Developer Guide (API Version 2012-08-10)
Did this page help you?  Yes | No |  Tell us about it...
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.

Using the AWS SDK for Java

The AWS SDK for Java provides APIs for the DynamoDB item and table operations. The SDK allows you to choose from among three different APIs:

APIComment

Document API

The AWS SDK for Java Document API provides an intuitive interface for DynamoDB operations. With this API, you work with Tables, Items, Attributes, and other objects that closely resemble their counterparts in the database. The Document API also provides utilities for working with document data types, such as Lists and Maps. Finally, the document API makes it easy to store and retrieve JSON documents in DynamoDB.

The following sections describe the document API and also provide working samples:

The Document API resides in the com.amazonaws.services.dynamodbv2.document namespace.

High-level API

The high-level API uses object persistence programming techniques to map Java objects to DynamoDB tables and attributes. In this API, the DynamoDBMapper class provides an object-oriented view of your data: You define getter and setter methods for attributes in a table, and DynamoDBMapper insulates your application from low-level DynamoDB operations. You cannot create tables using the high-level API, but you can create, read, update, and delete table items. The high-level API is especially advantageous if you have an existing code-base that you want to leverage by mapping to DynamoDB tables.

The high-level API resides in the com.amazonaws.services.dynamodbv2.datamodeling namespace.

Low-level API

The methods in the low-level API correspond closely to the underlying DynamoDB API. The low-level API allows you to perform the same operations that you can perform using DynamoDB operations such as create, update, and delete tables, and create, read, update, and delete items.

The low-level API resides in the com.amazonaws.services.dynamodbv2.model namespace.

Note

These APIs provide thread-safe clients for accessing DynamoDB. As a best practice, your applications should create one client and reuse the client between threads.

For more information about the AWS SDK for Java API, go to the AWS SDK for Java API Reference.

Choosing a JVM

For the best performance of your server-based applications with the AWS SDK for Java, we recommend that you use the 64-bit version of the Java Virtual Machine (JVM). This JVM runs only in Server mode, even if you specify the -Client option at run time. Using the 32-bit version of the JVM with the -Server option at run time should provide comparable performance to the 64-bit JVM.