i have one AmazonDynamoDB whose hashKey is: "userId" and rangeKey is: "timestamp".
I am writing one query for fetching up all records related to particular userId.
String keyConditionExpression = "userId = :userId";
HashMap<String, AttributeValue> attributeValuesMap = new HashMap<>();
attributeValuesMap.put(":userId", new AttributeValue().withS("someId"));
DynamoDBQueryExpression<MyTableItem> queryExpression =
new DynamoDBQueryExpression<MyTableItem>()
.withKeyConditionExpression(keyConditionExpression)
.withExpressionAttributeValues(attributeValuesMap)
.withConsistentRead(false);
dynamoDBMapper.queryPage(MyTableItem.class, queryExpression);
this query operation is failing, but not able to see, why it's failing. As given here, this should come under query criteria.
Any help would be really appreciated. Thanks.
I have tested the code and it runs as expected, returning the correct results. Is
userIdyour tables Partition Key?Can you share which error you are getting, that will help to recommend a solution.