3
votes

In order to use the most appropriate object, I try to figure out what are the differences between DynamoDBMapper and DynamoDB Table instance considering table construction, save, update, delete, query or scan operations.

Some methods:

    import com.amazonaws.services.dynamodbv2.document.Table;
    import com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper;

    ...

    mapper.save(bean, saveExpression);
    mapper.delete(bean);

    table.putItem(bean)
    table.updateItem(bean)
    table.deleteItem(HASH_KEY_NAME, bean.getHashKeyVal());

Those methods give the same results. Is DynamoDBMapper just a layer to facilitate interactions with DynamoDB Tables, or are there any scalability, read or write optimisations ?

Thanks for informations.

1

1 Answers

-1
votes

I guess you're asking about the difference between com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBMapper and com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTableMapper. Actually, the second is a wrapper for the first that is able to work only with a single table. DynamoDBMapper can work with multiple tables provided DynamoDBMapperConfig parameter for calls like save(), while the DynamoDBTableMapper captures single DynamoDBMapperConfig inside a field and uses it for the all the calls. DynamoDBTableMapper forwards all the calls to the underlying DynamoDBMapper.