Amazon dynamodb DynamoDB项目集合<;QueryYoutCome>;到java对象
我想将ItemCollection转换为我的java pojo对象。目前我想通过以下方式进行转换。最好的方法是什么Amazon dynamodb DynamoDB项目集合<;QueryYoutCome>;到java对象,amazon-dynamodb,dynamodb-queries,dynamo-local,amazon-dynamodb-data-modeling,Amazon Dynamodb,Dynamodb Queries,Dynamo Local,Amazon Dynamodb Data Modeling,我想将ItemCollection转换为我的java pojo对象。目前我想通过以下方式进行转换。最好的方法是什么 QuerySpec spec = new QuerySpec() .withKeyConditionExpression("txn_id = :txnId") .withFilterExpression("rrn = :rrn") .withV
QuerySpec spec = new QuerySpec()
.withKeyConditionExpression("txn_id = :txnId")
.withFilterExpression("rrn = :rrn")
.withValueMap(new ValueMap()
.withString(":txnId", txnId)
.withString(":rrn", rrn))
.withConsistentRead(true);
ItemCollection<QueryOutcome> items = table.query(spec);
是的,看一看。使用相同的pojo注释
CatalogItem partitionKey = new CatalogItem();
partitionKey.setId(102);
DynamoDBQueryExpression<CatalogItem> queryExpression = new DynamoDBQueryExpression<CatalogItem>()
.withHashKeyValues(partitionKey);
List<CatalogItem> itemList = mapper.query(CatalogItem.class, queryExpression);
for (int i = 0; i < itemList.size(); i++) {
System.out.println(itemList.get(i).getTitle());
System.out.println(itemList.get(i).getBookAuthors());
}
CatalogItem partitionKey=new CatalogItem();
partitionKey.setId(102);
DynamoDBQueryExpression queryExpression=新建DynamoDBQueryExpression()
.withHashKeyValues(partitionKey);
List itemList=mapper.query(CatalogItem.class,queryExpression);
对于(int i=0;i
public class Test implements Serializable {
@DynamoDBAttribute(attributeName = "txn_id")
@JsonProperty("txn_id")
@DynamoDBHashKey
private String txnId;
private String umn;
private String note;
@DynamoDBAttribute(attributeName = "rrn")
private String rrn;
@DynamoDBAttribute(attributeName = "expire_on")
private Date expireOn;
@DynamoDBAttribute(attributeName = "expire_after")
private Integer expireAfter;
@DynamoDBAttribute(attributeName = "created_on")
@DynamoDBAutoGeneratedTimestamp(strategy= DynamoDBAutoGenerateStrategy.CREATE)
private Date createdOn;
}
CatalogItem partitionKey = new CatalogItem();
partitionKey.setId(102);
DynamoDBQueryExpression<CatalogItem> queryExpression = new DynamoDBQueryExpression<CatalogItem>()
.withHashKeyValues(partitionKey);
List<CatalogItem> itemList = mapper.query(CatalogItem.class, queryExpression);
for (int i = 0; i < itemList.size(); i++) {
System.out.println(itemList.get(i).getTitle());
System.out.println(itemList.get(i).getBookAuthors());
}