dynamodb getitem android
Hi I'm trying to make a simple adnroid app that works with dynamodb and following through this tutorial:
Link of Tutorial
I have been able to connect with the dbClient and access the table. I can successfully perform the dbTable.putItem and also other methods like dbTable.getTableDescription.
I'm having trouble understanding how to execute and dbTable.getItem method which requires a Primitive as an input. I don't quite understand how to use the Hashkey or primary key.
My table looks like this:
Click image
these are the hash keys
Primary Key
When I execute this line of code:
Document doc = dbTable.getItem(new Primitive("1"));
where 1 is the value of the first value in the table.
I get this error.
java.lang.IllegalStateException: hash key type does not match the one
in table defination
at com.amazonaws.mobileconnectors.dynamodbv2.document.Table.makeKey(Table.java:720)
at com.amazonaws.mobileconnectors.dynamodbv2.document.Table.getItem(Table.java:298)
at com.example.user.dynamodb.MainActivity$1.run(MainActivity.java:65)
java android amazon-web-services amazon-dynamodb
|
show 1 more comment
Hi I'm trying to make a simple adnroid app that works with dynamodb and following through this tutorial:
Link of Tutorial
I have been able to connect with the dbClient and access the table. I can successfully perform the dbTable.putItem and also other methods like dbTable.getTableDescription.
I'm having trouble understanding how to execute and dbTable.getItem method which requires a Primitive as an input. I don't quite understand how to use the Hashkey or primary key.
My table looks like this:
Click image
these are the hash keys
Primary Key
When I execute this line of code:
Document doc = dbTable.getItem(new Primitive("1"));
where 1 is the value of the first value in the table.
I get this error.
java.lang.IllegalStateException: hash key type does not match the one
in table defination
at com.amazonaws.mobileconnectors.dynamodbv2.document.Table.makeKey(Table.java:720)
at com.amazonaws.mobileconnectors.dynamodbv2.document.Table.getItem(Table.java:298)
at com.example.user.dynamodb.MainActivity$1.run(MainActivity.java:65)
java android amazon-web-services amazon-dynamodb
Can you check what is the hashKey that you configured when you created the table in DynamoDB?
– Karthikeyan
Nov 13 at 21:58
@Karthikeyan I edited the OP please see the image. Is the Primary key equal to the Hashkey? Is the image the Hashkey you mean or something else. Can I ask how to determine the hashkey?
– Roland Jacob Patalinjug
Nov 14 at 7:57
Can you trynew Primitive(1)
where you pass in 1 without the string?
– Karthikeyan
Nov 14 at 18:42
passing 1 gives the same error
– Roland Jacob Patalinjug
Nov 15 at 7:31
DynamoDB supports two types of primary keys, a Hash Key and a Hash and Range Key. A Hash Key consists of a single attribute that uniquely identifies an item. A Hash and Range Key consists of two attributes that together, uniquely identify an item. In your table, can you find what did you set as the primary key? Is just 'seq' your hash key?
– Karthikeyan
Nov 15 at 17:13
|
show 1 more comment
Hi I'm trying to make a simple adnroid app that works with dynamodb and following through this tutorial:
Link of Tutorial
I have been able to connect with the dbClient and access the table. I can successfully perform the dbTable.putItem and also other methods like dbTable.getTableDescription.
I'm having trouble understanding how to execute and dbTable.getItem method which requires a Primitive as an input. I don't quite understand how to use the Hashkey or primary key.
My table looks like this:
Click image
these are the hash keys
Primary Key
When I execute this line of code:
Document doc = dbTable.getItem(new Primitive("1"));
where 1 is the value of the first value in the table.
I get this error.
java.lang.IllegalStateException: hash key type does not match the one
in table defination
at com.amazonaws.mobileconnectors.dynamodbv2.document.Table.makeKey(Table.java:720)
at com.amazonaws.mobileconnectors.dynamodbv2.document.Table.getItem(Table.java:298)
at com.example.user.dynamodb.MainActivity$1.run(MainActivity.java:65)
java android amazon-web-services amazon-dynamodb
Hi I'm trying to make a simple adnroid app that works with dynamodb and following through this tutorial:
Link of Tutorial
I have been able to connect with the dbClient and access the table. I can successfully perform the dbTable.putItem and also other methods like dbTable.getTableDescription.
I'm having trouble understanding how to execute and dbTable.getItem method which requires a Primitive as an input. I don't quite understand how to use the Hashkey or primary key.
My table looks like this:
Click image
these are the hash keys
Primary Key
When I execute this line of code:
Document doc = dbTable.getItem(new Primitive("1"));
where 1 is the value of the first value in the table.
I get this error.
java.lang.IllegalStateException: hash key type does not match the one
in table defination
at com.amazonaws.mobileconnectors.dynamodbv2.document.Table.makeKey(Table.java:720)
at com.amazonaws.mobileconnectors.dynamodbv2.document.Table.getItem(Table.java:298)
at com.example.user.dynamodb.MainActivity$1.run(MainActivity.java:65)
java android amazon-web-services amazon-dynamodb
java android amazon-web-services amazon-dynamodb
edited Nov 15 at 7:30
asked Nov 13 at 13:30
Roland Jacob Patalinjug
63
63
Can you check what is the hashKey that you configured when you created the table in DynamoDB?
– Karthikeyan
Nov 13 at 21:58
@Karthikeyan I edited the OP please see the image. Is the Primary key equal to the Hashkey? Is the image the Hashkey you mean or something else. Can I ask how to determine the hashkey?
– Roland Jacob Patalinjug
Nov 14 at 7:57
Can you trynew Primitive(1)
where you pass in 1 without the string?
– Karthikeyan
Nov 14 at 18:42
passing 1 gives the same error
– Roland Jacob Patalinjug
Nov 15 at 7:31
DynamoDB supports two types of primary keys, a Hash Key and a Hash and Range Key. A Hash Key consists of a single attribute that uniquely identifies an item. A Hash and Range Key consists of two attributes that together, uniquely identify an item. In your table, can you find what did you set as the primary key? Is just 'seq' your hash key?
– Karthikeyan
Nov 15 at 17:13
|
show 1 more comment
Can you check what is the hashKey that you configured when you created the table in DynamoDB?
– Karthikeyan
Nov 13 at 21:58
@Karthikeyan I edited the OP please see the image. Is the Primary key equal to the Hashkey? Is the image the Hashkey you mean or something else. Can I ask how to determine the hashkey?
– Roland Jacob Patalinjug
Nov 14 at 7:57
Can you trynew Primitive(1)
where you pass in 1 without the string?
– Karthikeyan
Nov 14 at 18:42
passing 1 gives the same error
– Roland Jacob Patalinjug
Nov 15 at 7:31
DynamoDB supports two types of primary keys, a Hash Key and a Hash and Range Key. A Hash Key consists of a single attribute that uniquely identifies an item. A Hash and Range Key consists of two attributes that together, uniquely identify an item. In your table, can you find what did you set as the primary key? Is just 'seq' your hash key?
– Karthikeyan
Nov 15 at 17:13
Can you check what is the hashKey that you configured when you created the table in DynamoDB?
– Karthikeyan
Nov 13 at 21:58
Can you check what is the hashKey that you configured when you created the table in DynamoDB?
– Karthikeyan
Nov 13 at 21:58
@Karthikeyan I edited the OP please see the image. Is the Primary key equal to the Hashkey? Is the image the Hashkey you mean or something else. Can I ask how to determine the hashkey?
– Roland Jacob Patalinjug
Nov 14 at 7:57
@Karthikeyan I edited the OP please see the image. Is the Primary key equal to the Hashkey? Is the image the Hashkey you mean or something else. Can I ask how to determine the hashkey?
– Roland Jacob Patalinjug
Nov 14 at 7:57
Can you try
new Primitive(1)
where you pass in 1 without the string?– Karthikeyan
Nov 14 at 18:42
Can you try
new Primitive(1)
where you pass in 1 without the string?– Karthikeyan
Nov 14 at 18:42
passing 1 gives the same error
– Roland Jacob Patalinjug
Nov 15 at 7:31
passing 1 gives the same error
– Roland Jacob Patalinjug
Nov 15 at 7:31
DynamoDB supports two types of primary keys, a Hash Key and a Hash and Range Key. A Hash Key consists of a single attribute that uniquely identifies an item. A Hash and Range Key consists of two attributes that together, uniquely identify an item. In your table, can you find what did you set as the primary key? Is just 'seq' your hash key?
– Karthikeyan
Nov 15 at 17:13
DynamoDB supports two types of primary keys, a Hash Key and a Hash and Range Key. A Hash Key consists of a single attribute that uniquely identifies an item. A Hash and Range Key consists of two attributes that together, uniquely identify an item. In your table, can you find what did you set as the primary key? Is just 'seq' your hash key?
– Karthikeyan
Nov 15 at 17:13
|
show 1 more comment
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53282139%2fdynamodb-getitem-android%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53282139%2fdynamodb-getitem-android%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Can you check what is the hashKey that you configured when you created the table in DynamoDB?
– Karthikeyan
Nov 13 at 21:58
@Karthikeyan I edited the OP please see the image. Is the Primary key equal to the Hashkey? Is the image the Hashkey you mean or something else. Can I ask how to determine the hashkey?
– Roland Jacob Patalinjug
Nov 14 at 7:57
Can you try
new Primitive(1)
where you pass in 1 without the string?– Karthikeyan
Nov 14 at 18:42
passing 1 gives the same error
– Roland Jacob Patalinjug
Nov 15 at 7:31
DynamoDB supports two types of primary keys, a Hash Key and a Hash and Range Key. A Hash Key consists of a single attribute that uniquely identifies an item. A Hash and Range Key consists of two attributes that together, uniquely identify an item. In your table, can you find what did you set as the primary key? Is just 'seq' your hash key?
– Karthikeyan
Nov 15 at 17:13