Java SDK中的AmazonDynamoDBClient和DynamoDB类之间的区别? [英] Difference between AmazonDynamoDBClient and DynamoDB classes in their java SDK?

查看:93
本文介绍了Java SDK中的AmazonDynamoDBClient和DynamoDB类之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Amazon的DynamoDB Java SDK,并且想知道 AmazonDynamoDBClient DynamoDB 类。由于文件很少,我似乎找不到任何东西。我有任何理由应该使用其中一个吗?它们有什么主要优点或缺点?

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?

推荐答案

这是一个好问题。看起来 DynamoDB AmazonDynamoDBClient 的包装,提供了一个不同的接口。因此,这可能很明显,而不是您要寻找的答案,但让我描述它们之间的一些区别。

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.

createTable AmazonDynamoDBClient 中的c $ c>方法返回 CreateTableResult 对象,而 DynamoDB 的createTable方法返回一个 Table 对象。然后,可以使用该 Table 对象对该表进行CRUD。 Table 对象开始看起来像DynamoDB的通用ORM对象。因此,它不是真正的 DynamoDB 类与 AmazonDynamoDBClient 类,它更像是 DynamoDB & Table 类与 AmazonDynamoDBClient

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 显然比 DynamoDB 类要老。 DynamoDB 是非常新的版本,发布于1.9.x。但是这里还有一个值得一提的类, DynamoDBMapper DynamoDBMapper 允许进行更多类似ORM的操作。允许开发人员注释其JavaBean数据模型,以便可以轻松地对DynamoDB表进行CRUD。您可以直接使用对象,并且 DynamoDBMapper 将在DynamoDB数据库上执行CRUD工作。 DynamoDBMapper 早于 DynamoDB 类。我认为也许有些开发人员不想使用 DynamoDBMapper (也许不是OO或注释的粉丝?),并且需要另一个范式,但我只是假设。因此,创建了 DynamoDB Table 类。与 AmazonDynamoDBClient 相比,使用 Table 类,您可以更轻松地与表进行交互,但是无需创建JavaBean数据, DynamoDBMapper 所需的模型。

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.

这篇关于Java SDK中的AmazonDynamoDBClient和DynamoDB类之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆