-
-
Save richardgrantserverless/b9be15dbb3a202b0ea10a19312aed994 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Product get(String id) throws IOException { | |
Product product = null; | |
HashMap<String, AttributeValue> av = new HashMap<String, AttributeValue>(); | |
av.put(":v1", new AttributeValue().withS(id)); | |
DynamoDBQueryExpression<Product> queryExp = new DynamoDBQueryExpression<Product>() | |
.withKeyConditionExpression("id = :v1") | |
.withExpressionAttributeValues(av); | |
PaginatedQueryList<Product> result = this.mapper.query(Product.class, queryExp); | |
if (result.size() > 0) { | |
product = result.get(0); | |
logger.info("Products - get(): product - " + product.toString()); | |
} else { | |
logger.info("Products - get(): product - Not Found."); | |
} | |
return product; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment