java里面是这样的:@Transactional
public void doAccount(Bean b) throws Exception{
  User user = userMapper.selectUserByUserId(b.getUserId());
  ...
  userMapper.updateUserAccount(b);
  ...
  paymentMapper.insertPayment(b)
  ...
}

解决方案 »

  1.   

    你的事物是DAO层还是service层的?
      

  2.   

    我也遇到了同样的问题,找了一下午都没找到好的解决方法,暂时只能通过编程式事务解决http://www.cnblogs.com/hawk0035/archive/2011/10/12/2208912.html
    找的解决办法告诉我一下,谢谢!
      

  3.   

    service层用注解写的事务配置,里面调用了2个dao层的方法
      

  4.   

    配置文件少了一个
    <tx:annotation-driven transaction-manager="transactionManager" />
      

  5.   

    main] DEBUG org.mybatis.spring.SqlSessionUtils - Closing no transactional SqlSession 
    就这句话不知道什么状况,应该是配置错了或者少了什么
      

  6.   

    <aop:aspectj-autoproxy proxy-target-class="true"/>

    <!-- 开启注解配置 -->  
        <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> 这样试试
      

  7.   

    报什么错? tx命名空间找不到吗?
    参考这个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的注解事务不会启动
      

  8.   


    楼主已经解决了吗,我和你遇到了同样的问题,但不知道你是怎么解决的?望告知,感谢!事务在service层,service通过接口注入即可.另外,报错的xml文件要把相关的jar包导入全就不会报错了