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;
复制代码
相关文章
相关标签/搜索