我的代码:
// 取得此商品编码表
DicProductBarcodeInfo barcodeInfo = (DicProductBarcodeInfo) replaceBarcodeCheckResult
.get(0);
// 判断带编码更换商品是否是同一商品
if (barcodeInfo.getProductId().intValue()
!= dicOutwareOrderAttach.getProductId().intValue())
{
System.out.println("更换商品"
+ dicOutwareOrderAttach.getProductId()
+ "与被更换商品" + barcodeInfo.getProductId()
+ "不是同一个商品!");
return "7";
} /**
* ******************************************
* 被更换商品编码状态由销售状态改为库存状态。
* ******************************************
*/
/*DicProductBarcodeInfo barcodeUpdate = new DicProductBarcodeInfo();
// 属性拷贝
try
{
BeanUtils.copyProperties(barcodeUpdate, barcodeInfo);
}
catch (Exception e){ }*/
// 此商品编码状态由”3-销售状态“更改为”0-库存状态“
barcodeInfo.setProductStsCode("0");
barcodeInfo.setKeepPosition(dicOutwareOrderMain
.getDepotName());
barcodeInfo.setNotes("更换入库!"); // 添加到待修改商品编码集合中
barcodeForUpdateList.add(barcodeInfo);我在这里把Entity的属性改了,但是后面又有其他的情况,程序直接返回了,未提交数据库,但是数据库中记录自动改了,请问怎么回事啊??
// 取得此商品编码表
DicProductBarcodeInfo barcodeInfo = (DicProductBarcodeInfo) replaceBarcodeCheckResult
.get(0);
// 判断带编码更换商品是否是同一商品
if (barcodeInfo.getProductId().intValue()
!= dicOutwareOrderAttach.getProductId().intValue())
{
System.out.println("更换商品"
+ dicOutwareOrderAttach.getProductId()
+ "与被更换商品" + barcodeInfo.getProductId()
+ "不是同一个商品!");
return "7";
} /**
* ******************************************
* 被更换商品编码状态由销售状态改为库存状态。
* ******************************************
*/
/*DicProductBarcodeInfo barcodeUpdate = new DicProductBarcodeInfo();
// 属性拷贝
try
{
BeanUtils.copyProperties(barcodeUpdate, barcodeInfo);
}
catch (Exception e){ }*/
// 此商品编码状态由”3-销售状态“更改为”0-库存状态“
barcodeInfo.setProductStsCode("0");
barcodeInfo.setKeepPosition(dicOutwareOrderMain
.getDepotName());
barcodeInfo.setNotes("更换入库!"); // 添加到待修改商品编码集合中
barcodeForUpdateList.add(barcodeInfo);我在这里把Entity的属性改了,但是后面又有其他的情况,程序直接返回了,未提交数据库,但是数据库中记录自动改了,请问怎么回事啊??
把事务改下就好 commit=true