1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 |
配置文件: <!-- 使用annotation定义事务 --> <tx:annotation-driven transaction-manager= "transactionManager" proxy-target- class = "true"
/> <bean id= "transactionManager" class = "org.springframework.jdbc.datasource.DataSourceTransactionManager" > <property name= "dataSource"
ref= "dataSource"
/> </bean> /** * 删除轮播图,实质是修改状态 */ @Transactional public
Integer removeFocusImg(MallFocusImg record) { try
{ MallFocus mallFocus = new
MallFocus(); mallFocus.setPageId(record.getId()); mallFocus.setIsdel(( byte ) 1 ); record.setIsdel(( byte ) 1 ); // 首先验证是否存在 int
c = focusDAO.selectFocusByPageId(mallFocus); if
(c < 1 ) { focusDAO.update(mallFocus); } int
count1 = focusImgDAO.update(record); return
count1; } catch
(Exception e) { return
null ; } } |
spring+mybatis的事务管理,布布扣,bubuko.com
原文:http://www.cnblogs.com/xuzhenmin/p/3584325.html