如何更新 Sugar ORM 中的记录?

How can update record in Sugar ORM?

我是 Sugar ORM 的新手,想更新 table

的简单一条记录
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();


这不会用记录更新 table。

在 sugar ORM 中,您的 class Paging Selected 是 Sugar Record 的扩展,因此您可以使用基本方法。

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));