问题:spring 声明式事务,不能回滚多个操作的事务
原因:在service方法里面加了 try{} catch(){},
解决:要把try catch放到action里面
原因:在service方法里面加了 try{} catch(){},
解决:要把try catch放到action里面
//Controller
@Controller
@RequestMapping("/versionLable")
public class DeviceVersionLabelController
{
@Resource(name = "versLabelService")
DeviceVersionLabelService versionLabelService;
@RequestMapping("/synchronousdata")
public ModelAndView test(HttpServletRequest request,
HttpServletResponse response)
{
try
{
versionLabelService.updateDeviceVersionLabel(hnInternetId,
uploadResponse.getPath());
}
catch (Exception e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return new ModelAndView("config/hnbversion_list");
}
}
//Service
@Service("versLabelService")
public class DeviceVersionLabelServiceImpl implements DeviceVersionLabelService
{
@Resource
private DeviceVersionLabelDao deviceVerDao;
/**
* 更新数据版本标签 {@inheritDoc}
*/
public void updateDeviceVersionLabel(String internetId, String fileName)
{
deviceVerDao.deleteSystemInfoLocal(internetId) throws Exception;
deviceVerDao.updateSecLocal(internetId) throws Exception;
}
}
//Dao
public interface DeviceVersionLabelDao
{
public void deleteSystemInfoLocal(String id)
throws Exception;
public void updateSecLocal(String id)
throws Exception;
}