标签:shu any tar action targe sim out review tostring
@Transactional(rollbackFor = { Exception.class })
public void test() {
try {
doDbStuff1();
doDbStuff2();
} catch (Exception e) {
e.printStackTrace();
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();//就是这一句了,加上之后,如果doDbStuff2()抛了异常, //doDbStuff1()是会回滚的
}
}
@RequestMapping("/add")
public String add(){
return "channel/addindex";
}
@RequestMapping("/addSub")
public String addSub(Channel channel){
System.out.println(channel.toString());
return "redirect:/channel/add";
}
标签:shu any tar action targe sim out review tostring
原文地址:http://www.cnblogs.com/-10086/p/6722108.html