List of usage examples for com.amazonaws.services.dynamodbv2.document TableKeysAndAttributes addPrimaryKey
public TableKeysAndAttributes addPrimaryKey(PrimaryKey primaryKey)
From source file:com.clicktravel.infrastructure.persistence.aws.dynamodb.DynamoDocumentStoreTemplate.java
License:Apache License
private <T extends Item> List<T> executeQuery(final KeySetQuery query, final Class<T> itemClass) { final ItemConfiguration itemConfiguration = getItemConfiguration(itemClass); final String tableName = databaseSchemaHolder.schemaName() + "." + itemConfiguration.tableName(); // max 100 keys per fetch final List<List<ItemId>> split_ids = split(new ArrayList<ItemId>(query.itemIds()), 100); final List<T> fetchedItems = new ArrayList<T>(); for (final List<ItemId> ids : split_ids) { final TableKeysAndAttributes keys = new TableKeysAndAttributes(tableName); for (final ItemId id : ids) { keys.addPrimaryKey(getPrimaryKey(id, itemConfiguration)); }/* w w w. j av a 2 s. c o m*/ processBatchRead(dynamoDBClient.batchGetItem(keys), fetchedItems, tableName, itemClass); } return fetchedItems; }