問題描述
我正在使用亞馬遜的 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.
AmazonDynamoDBClient
中的 createTable
方法返回一個 CreateTableResult
對象,而 DynamoDB
的 createTable 方法返回返回一個 Table
對象.然后可以使用這個 Table
對象對該表執行 CRUD.Table
對象開始看起來像 DynamoDB 的通用 ORM 對象.所以它不是真正的 DynamoDB
類 vs 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
類.使用 Table
類,您可以比 AmazonDynamoDBClient
更輕松地與表交互,但無需創建 DynamoDBMapper
所需的 JavaBean 數據模型的開銷.
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 類之間的區別?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!