我想将所有对象 ReportDB 保存为 DB 中的新行
App.get(context)
.getStorIO()
.put()
.object(new ReportDB(keyStore.getKeyCategoryId(), keyStore.getKeyShelfId()))
.prepare()
.asRxObservable().subscribe(putResult -> ZLog.d("insertedId = "+putResult.insertedId()),
throwable -> ZLog.d("throwable = ",throwable));
报告数据库是
@StorIOSQLiteColumn(name = ReportTable.COLUMN_ID,key = true)
long id;
@StorIOSQLiteColumn(name = ReportTable.CATEGORY_ID_I)
long categoryId;
@StorIOSQLiteColumn(name = ReportTable.SHELF_ID_I)
long shelfId;
@StorIOSQLiteColumn(name = ReportTable.LATITUDE_R)
double latitude;
@StorIOSQLiteColumn(name = ReportTable.LONGITUDE_R)
double longitude;
public ReportDB(long categoryId, long shelfId) {
this.categoryId = categoryId;
this.shelfId = shelfId;
}
但是现在,运行代码两次后,我只有一行和日志
insertedId = 0
insertedId = null
如何自动增加 id ?