日期:2014-05-17  浏览次数:20741 次

spring3+mybatis事务不回滚
Java code

public void createMemberAccount(TbMemberAccount account,
            TbRegisterActive active) {
        this.accountMapper.insertMemberAccount(account);
        memberId = account.getMemberId().longValue();
        active.setMemberId(memberId.intValue());
        active.setEmailAddress(null);
        this.activeMapper.insertRegisterActive(active);
}


首先是insertMemberAccount(account)成功
然后active.setEmailAddress(null);表中该字段不能为空所以insertRegisterActive(active);抛出异常
 但是insertMemberAccount(account)还是插入成功没有回滚事务

------解决方案--------------------
楼主先看下Spring事务配置的地方和网上的资料对比下,尤其是createMemberAccount方法是否属于pointcut,如果使用的是注解,该类是否加上相关注解。希望能帮上楼主忙。