Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between AmazonDynamoDBClient and DynamoDB classes in their java SDK?

I am using Amazon's DynamoDB java SDK and want to know the difference between the AmazonDynamoDBClient and DynamoDB classes. I can't seem to find anything on them since there appears to be very little documentation. Is there any reason I should use one or the other? Are their any major benefits or drawbacks?

like image 393
mnewton Avatar asked Jun 11 '15 06:06

mnewton


People also ask

What is DynamoDB enhanced client?

The Amazon DynamoDB enhanced client is a high-level library that is part of the AWS SDK for Java version 2 (v2). It offers a straightforward way to map client-side classes to DynamoDB tables. You define the relationships between tables and their corresponding model classes in your code.

Is DynamoDB client thread-safe?

The SDK for Java provides thread-safe clients for working with DynamoDB. As a best practice, your applications should create one client and reuse the client between threads.

What is Dynamodbasyncclient?

DynamoDB lets you offload the administrative burdens of operating and scaling a distributed database, so that you don't have to worry about hardware provisioning, setup and configuration, replication, software patching, or cluster scaling.

What is DynamoDB Mapper?

The DynamoDBMapper class is the entry point to Amazon DynamoDB. It provides access to a DynamoDB endpoint and enables you to access your data in various tables. It also enables you to perform various create, read, update, and delete (CRUD) operations on items, and run queries and scans against tables.


1 Answers

This is a good question. It looks like DynamoDB is a wrapper to the AmazonDynamoDBClient, providing a different interface. So this may be obvious and not the answer you are looking for but let me describe some of the differences between them.

The createTable method in AmazonDynamoDBClient returns back a CreateTableResult object, whereas the DynamoDB's createTable method returns back a Table object. This Table object can then be used to do CRUD on that table. The Table object starts looking like a generic ORM object for DynamoDB. So its not really DynamoDB class vs AmazonDynamoDBClient, its more like DynamoDB & Table classes vs AmazonDynamoDBClient.

AmazonDynamoDBClient is obviously older than the DynamoDB class. DynamoDB is pretty new, coming out in 1.9.x. But there is another class here worth mentioning, DynamoDBMapper. DynamoDBMapper allows for even more ORM like operations. Allowing developers to annotate their JavaBean data-model's so that they can easily be CRUD'd against a DynamoDB table. You get to work with your objects directly and the DynamoDBMapper will do the CRUD work on the DynamoDB database. DynamoDBMapper is older than the DynamoDB class. I think maybe some developers did not want to work with the DynamoDBMapper (maybe not a fan of OO or annotations?) and there needed to be another paradigm, but I'm only hypothesizing. So the DynamoDB and Table classes were created. With the Table class you can interact with your tables more easily than the AmazonDynamoDBClient but without the overhead of creating JavaBean data-models that the DynamoDBMapper require.

like image 77
Jose Martinez Avatar answered Oct 17 '22 07:10

Jose Martinez