前言:使用greendao是我从这个项目开始的,刚开始使用也是挺顺手,接入很方便,但是在使用过程中,突然发现有好多坑;现在整理一下,希望能帮到别人;
1.使用greendao更新数据数据之后,再次查询后居然不是更新过的数据,查询语句和查询逻辑过了一遍,没有任何问题,最后我在实体类中发现了问题:
@Generated(hash = 96597824)
public WorkTicketSecurityBean(Long id, int srSourceId, int srId, int srNumber,
String srTypeCode, String srTypeDesc, String sepObjectId, String description,
String attribute1, String srStatus, String overhaulSelf, String srContent,
int connenctNumber, int flag) {
this.id = id;
this.srSourceId = srSourceId;
this.srId = srId;
this.srNumber = srNumber;
this.srTypeCode = srTypeCode;
this.srTypeDesc = srTypeDesc;
this.sepObjectId = sepObjectId;
this.description = description;
this.attribute1 = attribute1;
this.srStatus = srStatus;
this.overhaulSelf = overhaulSelf;
this.srContent = srContent;
this.connenctNumber = connenctNumber;
this.flag = flag;
}
@Generated(hash = 1155046177)
public WorkTicketSecurityBean() {
}
这个是修改之后的代码,主要问题就是注解 @Generated ,这个注解的意思是:
GreenDao运行所产生的构造函数或者方法,被此标注的代码可以变更或者下次运行时清除
@Keep
注解的代码段在GreenDao下次运行时保持不变
1.注解实体类:默认禁止修改此类
2.注解其他代码段,默认禁止修改注解的代码段
这个会不会导致查询之后的无法修改这个实体类,还未验证,做此记录!