美文网首页
greendao升级(一)

greendao升级(一)

作者: 重新起步 | 来源:发表于2021-08-09 10:14 被阅读0次

greendao升级(一)
greendao升级(二)
greendao升级(三)
greendao升级(四)

greendao修改字段,未升级版本,导致报错

使用greendao时,我修改了一个ABean的一个属性,从BBean变为了List<BBean>,


@Entity

public class ABean {

    private int first;

    private BBean bBean;

}

改为:


@Entity

public class ABean {

    private int first;

    private List<BBean> bBeans;

}

重新运行app,出现如下报错;

原因就是,修改bean类,会导致数据库格式变化,此时需要升级数据库才能解决这个问题;
备注:默认greendao是不会存在该问题的,我的是因为代码中使用了自定义的DaoMaster.OpenHelper,但是没有复写onUpdate方法;

那么如何升级数据库呢?
参考greendao升级(二)

相关文章

网友评论

      本文标题:greendao升级(一)

      本文链接:https://www.haomeiwen.com/subject/tcxzvltx.html