【发布时间】:2020-08-25 22:57:03
【问题描述】:
我是 DynamoDB 的新手,想知道如何使用 hashKey 和 sortKey 查询 DynamoDB 中的表。
我有一个名为Items 的表。它的架构是
1. Product (Partition Key of type String)
2. ID (Sort Key of type int)
3. Date ( attribute of type String)
我对获取所有具有product = 10 的项目的查询是
Items it = new Items();
it.setProduct("apple");
DynamoDBQueryExpression<Items> queryExpression = new DynamoDBQueryExpression<Items>()
.withHashKeyValues(it);
List<Items> itemList = mapper.query(Items.class, queryExpression);
但是,现在我想获取所有具有Product = "apple" 和ID = 100 的项目。
我可以在 Java 中为 DynamoDB 编写查询。
【问题讨论】:
标签: java amazon-dynamodb