greendao - How can I persist an HashMap? -



greendao - How can I persist an HashMap<String, String>? -

how persist hashmap in greendao , how generate respective entities?

i have read documentation twice going forwards , backward nil there. google wasn't of help either.

you should create entity string-primary-key , string-proerty value:

entity mapentity = schema.addentity("map"); mapentity.addstringproperty("key").primarykey(); mapentity.addstringproperty("value");

maybe other attributes properties needed (depending on needs) unique, notnull.

if want store map within entity, that's not quite simple:

basically create entity storing maps:

entity mapentity = schema.addentity("map"); mapentity.addlongproperty("id").primarykey().autoincrement(); mapentity.addstringproperty("key").unigue().notnull(); mapentity.addstringproperty("value");

and create relation toone() or tomany() reference corresponding map.

p.s. maybe should take other names key , value. these variable names used , may produce conflicts in greendao.

greendao greendao-generator

Comments

Popular posts from this blog

maven fortify plugin : Unable to load build session with ID XXXXX .. See log file for more details -

c# - Primavera WebServices does not return any data -

android - Display emoji panel with genymotion - keyboard/touch input? -