I'm new to data base and therefore I preferred to use Sugar ORM
instead of SQLite
in my android project.
But there is a problem. whenever I use the SugarRecord.update()
method to update and existing record all records are replaced by the new record.
Could anyone please help me with an answer?
@Override
public void updateInDataBase(Bookmark bookmark, long id) {
History oldHistory = History.findById(History.class, id);
LogManager.d("owntest oldHistory In update " + oldHistory);
oldHistory.setLastUpdateTime(System.currentTimeMillis());
oldHistory.update();
}
It seems you have found a bug that is described here. https://github.com/chennaione/sugar/issues/633. It may be the case, that the author intended this for some reason, though I am not sure. Nevertheless, you can and probably should use the save() method as suggested by the official docs: http://satyan.github.io/sugar/getting-started.html#usage