Sugar orm更新错误
Sugar orm update bug
我是数据库的新手,因此我更喜欢在我的 android 项目中使用 Sugar ORM
而不是 SQLite
。
但是有个问题。每当我使用 SugarRecord.update()
方法更新现有记录时,所有记录都会被新记录替换。
谁能帮我解答一下?
@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();
}
您似乎发现了此处描述的错误。
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
我是数据库的新手,因此我更喜欢在我的 android 项目中使用 Sugar ORM
而不是 SQLite
。
但是有个问题。每当我使用 SugarRecord.update()
方法更新现有记录时,所有记录都会被新记录替换。
谁能帮我解答一下?
@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();
}
您似乎发现了此处描述的错误。 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