Using StringSets Amazon DynamoDB Android -
i have android application uses amazon dynamodb. table of users this:
@dynamodbtable(tablename = const.test_table_name) public static class user { private int userid; private string username; private string password; private string email; @dynamodbhashkey(attributename = "userid") public int getuserid() { return userid; } public void setuserid(int userid) { this.userid = userid; } @dynamodbattribute(attributename = "username") public string getusername() { return username; } public void setusername(string username) { this.username = username; } @dynamodbattribute(attributename = "password") public string getpassword() { return password; } public void setpassword(string password) { this.password = password; } @dynamodbattribute(attributename = "email") public string getemail() { return email; } public void setemail(string email) { this.email = email; } }
and works fine. question is, if have string set in table how can insert code? using string[]
doesn't work( i've tried adding:
private string[] favourites; @dynamodbattribute(attributename = "favourites") public string[] getfavourites() { return favourites; } public void setfavourites(string[] favourites) { this.favourites = favourites; }
) keeps throwing errors. can me?
you working set
of string
. if using default conversionscheme
part of dynamodbmapperconfig
(which if don't specify own configuration, default used), need change type java's set<string>
, mapper marshall appropriately.
private set<string> favourites; @dynamodbattribute(attributename = "favourites") public set<string> getfavourites() { return favourites; }
Comments
Post a Comment