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 an API for the DynamoDB item and table operations. The SDK gives you the option of using a low-level or high-level API:

APIComment

Low-level API

The methods in the low-level API correspond closely to the underlying DynamoDB operations. 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 following sections describe the low-level API in various AWS SDKs and also provide working samples:

High-level API

The high-level API uses object persistence programming techniques to map Java objects to DynamoDB tables and attributes. You cannot create tables using the high-level API, but you can create, read, update, and delete table items. You can use the high-level API if you have an existing code-base that you want to leverage by mapping to DynamoDB tables.

Note

The low-level API and high-level API provide thread-safe clients for accessing DynamoDB. As a best practice, your applications should create one client and reuse the client between threads.

The Java API Organization

The AWS SDK for Java uses the following namespaces:

  • com.amazonaws.services.dynamodbv2—Provides the implementation APIs for DynamoDB item and table operations.

    For example, it provides methods to create, update, and delete tables, and create, upload, read, and delete table items.

  • com.amazonaws.services.dynamodbv2.model—Provides the low-level API classes to create requests and process responses.

    For example, it includes the GetItemRequest class to describe your get item request, the PutItemRequest class to describe your item put requests, and the DeleteItemRequest class to describe your item delete request.

  • com.amazonaws.services.dynamodbv2.datamodeling—Provides the high-level API operations.

    The high-level API allows you to use object persistence programming techniques to map Java objects to DynamoDB tables and perform create, read, update, and delete actions on your table items. The high-level API provides the DynamoDBMapper, which is an object mapper class that you use to map between your Java classes and your tables in DynamoDB.

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.