java 使用 DynamoDBMapper 获取所有项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31391311/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fetching All Items with DynamoDBMapper
提问by Bex
I want to get all of the records from a Dynamo DB table and have them mapped into an array of POJOs; The POJO is simple and already annotated.
我想从 Dynamo DB 表中获取所有记录,并将它们映射到一个 POJO 数组中;POJO 很简单并且已经注释了。
DynamoDBMapper appears to be the object that will do a fetch to acquire the records and deserialize them into my POJOs. Perhaps using PaginatedScanList() to walk through the entire table.
DynamoDBMapper 似乎是将执行获取以获取记录并将它们反序列化为我的 POJO 的对象。也许使用 PaginatedScanList() 来遍历整个表格。
Mapper's Scan() and PaginatedScanList() methods both require a DynamoDBScanExpression parameter. What DynamoDBScanExpression would be used to select all of the records in the table?
Mapper 的 Scan() 和 PaginatedScanList() 方法都需要 DynamoDBScanExpression 参数。什么 DynamoDBScanExpression 将用于选择表中的所有记录?
回答by Chen Harel
You can pass a new DynamoDBScanExpression()
into the scan method.:
您可以将 anew DynamoDBScanExpression()
传入 scan 方法。:
mapper.scan(MyObject.class, new DynamoDBScanExpression());
Or you could use the new Document API
或者您可以使用新的 Document API