Difference between AmazonDynamoDBClient and DynamoDB classes in their Java SDK?

I am using the Amazon DynamoDB java SDK and want to know the difference between AmazonDynamoDBClient and DynamoDB . I can't seem to find anything on them, because there seems to be very little documentation. Is there any reason why I should use this or that? Are their main advantages or disadvantages?

+6
source share
1 answer

That's a good question. DynamoDB seems to be a wrapper for AmazonDynamoDBClient , providing a different interface. So this may be obvious, not the answer you are looking for, but let me describe some of the differences between them.

The createTable method in AmazonDynamoDBClient returns a CreateTableResult object, while the DynamoDB createTable method returns a Table object. This Table object can then be used to run CRUD on this table. The Table object begins to look like a generic ORM object for DynamoDB. Thus, this is not the DynamoDB vs AmazonDynamoDBClient , more similar to the DynamoDB and Table vs AmazonDynamoDBClient .

AmazonDynamoDBClient clearly older than the DynamoDB class. DynamoDB fairly new, coming out at 1.9.x. But here is another class worth mentioning, DynamoDBMapper . DynamoDBMapper allows you to perform even more operations with ORM. Allowing developers to annotate their JavaBean data model so that they can easily be CRUD'd against the DynamoDB table. You can work directly with your objects, and DynamoDBMapper will do CRUD work in the DynamoDB database. DynamoDBMapper older than the DynamoDB class. I think that some developers did not want to work with DynamoDBMapper (maybe not a fan of OO or annotations?), And there should be a different paradigm, but I only hypothesize. Thus, the DynamoDB and Table classes were created. With the Table class, you can more easily interact with your tables than AmazonDynamoDBClient , but without the overhead of creating the JavaBean data models that DynamoDBMapper requires.

+13
source

Source: https://habr.com/ru/post/988896/


All Articles