ITeye博客

多线程/Hibernate/调用属性时候 间隔发生的诡异问题:debug能看到属性值,但访问属性却nullpointerEx(应用产品问题)

fanyo · 2010-10-25 16:04 · 企业架构 · Markdown

当调用一个命令reset operations 时候启动4个线程 做一些操作.
这个重复命令执行大约运行七八次,assetMove.getAssetType().getType()就会返回一次nullpointerException.

    public TmEquipmentType getAssetType() {
        return (_asset != null) ? _asset.getType() : _containerPlanEquipmentType.getEquipmentType();
    }

TmAssetMoveImpl.hbm.xml
        <many-to-one name="containerPlanEquipmentType"

                    

class="com.redprairie.tm.core.TmContainerPlanEquipmentTypeImpl" >
            <column name="container_plan_equip_id" />
        </many-to-one>

TmContainerPlanEquipmentTypeImpl.hbm.xml
       <many-to-one name="equipmentType"

                    

class="com.redprairie.tm.assets.TmEquipmentTypeImpl">
            <column name="equip_typ" />
       </many-to-one>

我改了下assetMove.getAssetType() 进行debug, assetMove.getAssetType()明明能看到值, 但是调用它的属性的时候就会Nullpointer.

起初运行 五六次命令会出现一次异常,  后来改来将

containerPlanEquipmentType.getEquipmentType()

set和get方法同步一下  运行一百次命令出现一次异常.

 

难道和hibernate的lazy 或者什么其他设置有关?

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。