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

当调用一个命令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
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值