Database Reference
In-Depth Information
Storing data in the table
Let's take a look at a table where you want to store some data about the user, such as a first
name, his/her location, and his/her highest exam score. You can create the table in many
ways, but here you will go through the following way which is much easier in DynamoDB.
Try to remember the first four chapters in which you learned about hash keys and range
keys. You are going to use those fundamentals here frequently. So assume that your first
look of the table will be like this:
Here, your BookId function will be your hash key to recognize the topic uniquely, which
will be stored as a numeric value. The RecordId function will work as your range key to
recognize the record corresponding with the topic and will be stored as a string. The Data
field will work as the actual record for the topics. In this example, you will learn for both
platforms: iOS and Android.
To load specific data, follow the given code for iOS and Android.
Android
The following code is used to load specific data for Android:
Map<String, AttributeValue> key = new HashMap<String,
AttributeValue>();
key.put("BookId", 4321);
key.put("RecordId", "bookname");
GetItemRequest getItemRequest = new
GetItemRequest("BookTableExample",key);
GetItemResult getItemResult =
Search WWH ::




Custom Search