GreenDao3.0 中踩到的巨坑

 在GreenDao 使用中 设置了主外键,  主表中的数据插入, 从表中的数据也须要手工插入,不会自动插入this

巨坑,可是在查询的时候会查询出来ip

还有个坑  若是从表数据没有插入, 直接插入主表数据, 在第一次查询的时候会被查出来,正是由于这个缘由致使后期出现不少问题。太坑,太坑,太坑get

/**
 * To-one relationship, resolved on first access.
 */
@Generated(hash = 1299602490)
public Family getFamily() {
    String __key = this.familyInfoId;
    if (family__resolvedKey == null || family__resolvedKey != __key) {
        final DaoSession daoSession = this.daoSession;
        if (daoSession == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        FamilyDao targetDao = daoSession.getFamilyDao();
        Family familyNew = targetDao.load(__key);
        synchronized (this) {
            family = familyNew;
            family__resolvedKey = __key;
        }
    }
    return family;
}
相关文章
相关标签/搜索