在GreenDao 使用中 设置了主外键, 主表中的数据插入, 从表中的数据也需要手工插入,不会自动插入
巨坑,但是在查询的时候会查询出来
还有个坑 如果从表数据没有插入, 直接插入主表数据, 在第一次查询的时候会被查出来,正是因为这个原因导致后期出现很多问题。太坑,太坑,太坑
/** * 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; }