java里面是这样的:@Transactional
public void doAccount(Bean b) throws Exception{
User user = userMapper.selectUserByUserId(b.getUserId());
...
userMapper.updateUserAccount(b);
...
paymentMapper.insertPayment(b)
...
}
public void doAccount(Bean b) throws Exception{
User user = userMapper.selectUserByUserId(b.getUserId());
...
userMapper.updateUserAccount(b);
...
paymentMapper.insertPayment(b)
...
}
解决方案 »
- showModalDialog分页给父页面传值问题
- 为什么session.sava(person)里面只有select语句,没有insert语句 ???? 数据保存不了!没有被写入数据库!
- spring+ibatis整合错误问题,谁帮我看看问题在哪?错误提示: No SqlMapClient specified
- hibernate one2many映射
- 求 spring applicationContext.xml 头部两种写法的区别?
- web http server间有那些通讯方式啊?
- xsl.jar 发一个给我啊
- struts tiles框架中相对路径问题向高手请教?
- 提问:用DOM解析xml的问题,高手求助,急!!!
- 求助struts中*.jsp页面访问权限解决方法;(100)
- Servlet中如何获取response的statusCode
- JDBC数据库问题-时间的自动获取
找的解决办法告诉我一下,谢谢!
<tx:annotation-driven transaction-manager="transactionManager" />
就这句话不知道什么状况,应该是配置错了或者少了什么
<!-- 开启注解配置 -->
<context:annotation-config /> <context:component-scan base-package="com.xxx.mobileinternet.service" />
<!-- 开启事务注解驱动 -->
<tx:annotation-driven />
<!-- 事务管理器 -->
<bean id="transactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="cmsOracle" />
</bean> 这样试试
参考这个xml头<beans
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
没有 tx:annotation-driven标签,spring的注解事务不会启动
楼主已经解决了吗,我和你遇到了同样的问题,但不知道你是怎么解决的?望告知,感谢!事务在service层,service通过接口注入即可.另外,报错的xml文件要把相关的jar包导入全就不会报错了