/** * Saves and deletes the objects given using one or more calls to the * batchWriteItem API. * @param objectsToWrite The objects to write. * @param objectsToDelete The objects to delete. * @return The list of failed batches. * @see com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper#batchWrite */ public List<DynamoDBMapper.FailedBatch> batchWrite(Iterable<T> objectsToWrite, Iterable<T> objectsToDelete) { return mapper.batchWrite(objectsToWrite, objectsToDelete); }
/** * Saves the objects given using one or more calls to the batchWriteItem API. * @param objectsToSave The objects to save. * @return The list of failed batches. * @see com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper#batchSave */ public List<DynamoDBMapper.FailedBatch> batchSave(Iterable<T> objectsToSave) { return mapper.batchWrite(objectsToSave, (Iterable<T>)Collections.<T>emptyList()); }
/** * Deletes the objects given using one or more calls to the batchWtiteItem API. * @param objectsToDelete The objects to delete. * @return The list of failed batches. * @see com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper#batchDelete */ public List<DynamoDBMapper.FailedBatch> batchDelete(Iterable<T> objectsToDelete) { return mapper.batchWrite((Iterable<T>)Collections.<T>emptyList(), objectsToDelete); }
/** * Saves and deletes the objects given using one or more calls to the * batchWriteItem API. * @param objectsToWrite The objects to write. * @param objectsToDelete The objects to delete. * @return The list of failed batches. * @see com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper#batchWrite */ public List<DynamoDBMapper.FailedBatch> batchWrite(Iterable<T> objectsToWrite, Iterable<T> objectsToDelete) { return mapper.batchWrite(objectsToWrite, objectsToDelete); }
/** * Saves the objects given using one or more calls to the batchWriteItem API. * @param objectsToSave The objects to save. * @return The list of failed batches. * @see com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper#batchSave */ public List<DynamoDBMapper.FailedBatch> batchSave(Iterable<T> objectsToSave) { return mapper.batchWrite(objectsToSave, (Iterable<T>)Collections.<T>emptyList()); }
/** * Deletes the objects given using one or more calls to the batchWtiteItem API. * @param objectsToDelete The objects to delete. * @return The list of failed batches. * @see com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper#batchDelete */ public List<DynamoDBMapper.FailedBatch> batchDelete(Iterable<T> objectsToDelete) { return mapper.batchWrite((Iterable<T>)Collections.<T>emptyList(), objectsToDelete); }
private static void testBatchWrite(DynamoDBMapper mapper) { // Create Forum item to save Forum forumItem = new Forum(); forumItem.name = "Test BatchWrite Forum"; forumItem.threads = 0; forumItem.category = "Amazon Web Services"; // Create Thread item to save Thread threadItem = new Thread(); threadItem.forumName = "AmazonDynamoDB"; threadItem.subject = "My sample question"; threadItem.message = "BatchWrite message"; List<String> tags = new ArrayList<String>(); tags.add("batch operations"); tags.add("write"); threadItem.tags = new HashSet<String>(tags); // Load ProductCatalog item to delete Book book3 = mapper.load(Book.class, 903); List<Object> objectsToWrite = Arrays.asList(forumItem, threadItem); List<Book> objectsToDelete = Arrays.asList(book3); DynamoDBMapperConfig config = new DynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior.CLOBBER); mapper.batchWrite(objectsToWrite, objectsToDelete, config); }