Reputation: 370
Both of these classes may be used to access a DynamoDB. In what cases would I use one over the other, when using the iOS SDK?
Upvotes: 0
Views: 516
Reputation: 14905
In two lines :
AWSDynamoDB is a DynamoDB API client class.
AWSDynamoDBObjectMapper is a higher level object, a database persistence framework.
AWSDynamoDB
This class wraps the DynamoDB API. You provide methods of this class with a DynamoDBRequest object that describes the operation you want to perform, and it will return a Response object that describe s the result of your request or an error, if any. This low level and mostly match the DynamoDB HTTP API
AWSDynamoDBObjectMapper
When using AWSDynamoDBObjectMapper, you create a class that represent the item you want to store / retrieve from the database. Then you pass instances of this class to higher level methods such as save()
, delete()
etc...
This is a much higher level of abstraction. Similar in philosophy to Object Relational frameworks such as Hibernate for example.
More details and code sample in Objective C are available here : http://docs.aws.amazon.com/mobile/sdkforios/developerguide/dynamodb_om.html
I also posted a Swift code sample when answering this question : Best way to make Amazon AWS DynamoDB queries using Swift?
Upvotes: 3