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

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -