GreenDao使用注意事項

  • 若是新版本中新增長了表,須要修改greendao配置中schemaVersion,讓其加1便可
greendao {
    schemaVersion, 2
    daoPackage 'com.xx.xx.storage.db.base'
    targetGenDir 'src/main/java'
}
複製代碼

不然出現以下錯誤java

android.database.sqlite.SQLiteException: no such column:
複製代碼
  • greendao中model的定義id時,若是id不是String,那麼id必須定義爲long,不能爲int
@Id
@Unique
public long id;
複製代碼
相關文章
相關標籤/搜索