我是Sugar ORM的新手,想要更新表中的简单记录
List<PagingSelected> finds = (List<PagingSelected>) PagingSelected.findWithQuery(PagingSelected.class,"Select * from "+NamingHelper.toSQLNameDefault("PagingSelected")+" LIMIT 1");
finds.get(0).setNext(true);
finds.get(0).update();
这不会使用记录更新表。
答案 0 :(得分:0)
在糖ORM中,您的PagingSelected类是SugarRecord的扩展,因此您可以使用基本方法。
List<PagingSelected> finds = (List<PagingSelected>) PagingSelected.findWithQuery(PagingSelected.class,"Select * from "+NamingHelper.toSQLNameDefault("PagingSelected")+" LIMIT 1");
finds.get(0).setNext(true);
PagingSelected.saveInTx(finds.get(0));