请问在什么情况下,hibernate更新对象的时候,会失效哦?
请看下,我这执行日志
2012-06-26 12:03:33 INFO http-8080-6 ControllerLogger - 商户编号:2012062612025930;高阳编号:888000400005094
2012-06-26 12:03:33 INFO http-8080-6 ControllerLogger - 更新开始
2012-06-26 12:03:33 INFO http-8080-6 ControllerLogger - origBusiTemp.getMerchId():888000400005094
2012-06-26 12:03:33 INFO http-8080-6 ControllerLogger - origBusiTemp.getBusiCode():2012062612025930
2012-06-26 12:03:33 INFO http-8080-6 ControllerLogger - 更新结束
2012-06-26 12:03:33 INFO http-8080-6 ControllerLogger - BusiSettleMentController.queryAddContracts:2012062612025930
其对应的代码是:
logger.info("商户编号:"+busiCode+";高阳编号:"+merchId);
if (busiCode != null&&!"".equals(busiCode)) {
MetaBusiTemp origBusiTemp = metaBusiBO.queryBusiTempByKey(busiCode);
if (origBusiTemp != null) {
if(!"".equals(origBusiTemp.getBusiCode())&&origBusiTemp.getBusiCode()!=null){
logger.info("更新开始");
origBusiTemp.setMerchId(merchId);
logger.info("origBusiTemp.getMerchId():"+origBusiTemp.getMerchId());
logger.info("origBusiTemp.getBusiCode():"+origBusiTemp.getBusiCode());
metaBusiBO.updateBusi(origBusiTemp);
logger.info("更新结束");
}
}
}
我现在遇到这样的问题,就是偶尔会发生数据没有更新的情况下。我就纳闷了,日志上,明明都打印了merchId是有数据的,但是更新到数据库中,依然是空的,请问在什么情况下,hibernate更新对象的时候,会失效哦?
------解决方案--------------------update以后flush试试看
------解决方案--------------------http://blog.csdn.net/roadanddream/article/details/6712807