I'm setting up basic app to upload data to DynamoDB. I was following aws tutorial. But I have an error which should not happen. Here's my code:
This is the class for my item to upload:
package com.plexinc.easyorder;
import com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBAttribute;
import com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBHashKey;
import com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBTable;
@DynamoDBTable(tableName="Bars")
public class Bar {
private String BarID;
private String PlaceName;
private String Address;
@DynamoDBHashKey(attributeName="BarID")
public String getBarID(){
return BarID;
}
public void setBarID(String BarID){
this.BarID = BarID;
}
@DynamoDBAttribute(attributeName = "PlaceName")
public String getPlaceName(){
return PlaceName;
}
public void setPlaceName(String Name) {
this.PlaceName = Name;
}
@DynamoDBAttribute(attributeName = "Address")
public String getAddress(){
return Address;
}
public void setAddress(String Address) {
this.Address = Address;
}
}
And here is the call to dynamoDB:
Bar testBar = new Bar();
testBar.setAddress("thisisAddress 123123");
testBar.setPlaceName("Meltdown");
testBar.setBarID(UUID.randomUUID().toString());
new android.os.AsyncTask<Bar, Void, Void>() {
@Override
protected Void doInBackground(Bar... toSave) {
DynamoDBMapper mapper = new DynamoDBMapper(MainActivity.client);
mapper.save(toSave);
return null;
}
}.execute(testBar);
When I try to executer the code I get the error: class [Lcom.plexinc.easyorder.Bar; must be annotated with interface com.amazonaws.mobileconnectors.dynamodbv2.dynamodbmapper.DynamoDBTable
I checked the syntax on @DynamoDBTable but it is exactly the same as the one in the tutorial. I don't understand and this is certainly a stupid mistake but I can't figure it out.
Thanks for the answers