I'm using greenDao for my Android project and I did not get any official documentation on how to update SQLite table using greenDao. I found some .update()
method there to edit, but looks like it's not recommended.
-
What do you mean by update SQLite table? Update the values of the rows? O update the columns of the table?– Jofre MateuJun 19, 2015 at 8:55
-
Updating the values in populated SQL table– Prathmesh DeshmukhJun 19, 2015 at 9:05
Add a comment
|
1 Answer
Here's some code updating an entity. You don't have to modify the generated class.
db = helper.getWritableDatabase();
DaoMaster daoMaster = new DaoMaster(db);
DaoSession daoSession = daoMaster.newSession();
ExampleDao exampleDao = daoSession.getExampleDao();
Example example = exampleDao.load(exampleKey);
/* Make your changes in the object */
exampleDao.update(example);
If you need more documentation you can have a look here and here.