Android 如何使用SugarORM获取特定记录的默认保存id?

Android 如何使用SugarORM获取特定记录的默认保存id?,android,Android,您好,我已经在我的应用程序中实现了sugar orm for sql transaction。我想获取特定记录的sugar orm生成的默认id。请帮助我。任何帮助都将不胜感激。提前感谢。我正在使用下面的sugar orm链接 我使用以下代码获取特定记录的id List<Book> books = new ArrayList<>(); books.add(new Book("Title here 1", "1st edition"));

您好,我已经在我的应用程序中实现了sugar orm for sql transaction。我想获取特定记录的sugar orm生成的默认id。请帮助我。任何帮助都将不胜感激。提前感谢。我正在使用下面的sugar orm链接

我使用以下代码获取特定记录的id

List<Book> books = new ArrayList<>();
        books.add(new Book("Title here 1", "1st edition"));
        books.add(new Book("Title here 2", "2nd edition"));
        books.add(new Book("Title here 3", "3rd edition"));
        SugarRecord.saveInTx(books);

        //update
        Book book = Book.findById(Book.class,1);
        book.title = "john smith";
        book.save();

        List<Book> booksone = Book.findWithQuery(Book.class,"Select id from Book where title = ?","john smith");
List books=new ArrayList();
图书。添加(新书(“此处标题1”,“第一版”);
图书。添加(新书(“此处标题2”,“第二版”);
图书。添加(新书(“第三版标题”);
SugarRecord.saveInTx(图书);
//更新
Book Book=Book.findById(Book.class,1);
book.title=“约翰·史密斯”;
book.save();
List booksone=Book.findWithQuery(Book.class,“从书中选择id,其中标题=?”,“john smith”);