手机
当前位置:查字典教程网 >编程开发 >安卓软件开发 >Android GreenDao 获取一对多内容实体时候报错:Entity is detached from DAO context 请问是什么原因?
Android GreenDao 获取一对多内容实体时候报错:Entity is detached from DAO context 请问是什么原因?
摘要:功能:列表中选择分类,然后获取与该类别关联的对象List,添加到数据源中,再刷新ListView。de.greenrobot.dao.Dao...

功能: 列表中选择分类,然后获取与该类别关联的对象List,添加到数据源中,再刷新ListView。

de.greenrobot.dao.DaoException: Entity is detached from DAO context

在拿到自己1对多的实体内容的时候,会报出该异常。第一次是没问题的。

/** To-many relationship, resolved on first access (and after reset). Changes to to-many relations are not persisted, make changes to the target entity. */
    public List< CasesFormInfo > getCasesFormInfoList() {
        if (casesFormInfoList == null) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            CasesFormInfoDao targetDao = daoSession.getCasesFormInfoDao();
            List< CasesFormInfo > casesFormInfoListNew = targetDao._queryCasesFormCategoryInfo_CasesFormInfoList(paramid);
            synchronized (this) {
                if(casesFormInfoList == null) {
                    casesFormInfoList = casesFormInfoListNew;
                }
            }
        }
        return casesFormInfoList;
    }

求指点!感激不尽!

回复讨论(解决方案)

解决了吗?我最近在用,碰到同样的问题了

【Android GreenDao 获取一对多内容实体时候报错:Entity is detached from DAO context 请问是什么原因?】相关文章:

Android 获取进程内存使用情况方法

android获取音乐文件的内置专辑图片实现思路及代码

深入理解Android Matrix理论与使用的详解

Android通话记录备份实现代码

android MVC中如何在在controller中进行页面跳转(到其他Activity)

android之自定义Toast使用方法

Android内存调试命令

如何配置安卓模拟器 dex文件不被优化成odex

Android控件系列之EditText使用方法

android判断phonegap是否联网且加载super.loadUrl网址

精品推荐
分类导航