List of usage examples for com.amazonaws.services.dynamodbv2.datamodeling DynamoDBQueryExpression withIndexName
public DynamoDBQueryExpression<T> withIndexName(String indexName)
From source file:com.makariev.dynamodb.preferences.UserPreferenceObjectMapperService.java
License:Open Source License
private List<UserPreference> queryByNames(String firstName, String lastName) { DynamoDBQueryExpression<UserPreference> dynamoDBQueryExpression = new DynamoDBQueryExpression<>(); dynamoDBQueryExpression.withIndexName(UserPreference.NAME_INDEX); dynamoDBQueryExpression.withRangeKeyCondition("firstName", new Condition().withComparisonOperator(ComparisonOperator.EQ) .withAttributeValueList(new AttributeValue().withS(firstName))); dynamoDBQueryExpression.withRangeKeyCondition("lastName", new Condition().withComparisonOperator(ComparisonOperator.EQ) .withAttributeValueList(new AttributeValue().withS(lastName))); final List<UserPreference> list = mapper.query(UserPreference.class, dynamoDBQueryExpression); return list;// w w w . j av a 2 s . c o m }