读书人

spring3+mybatis事务不回滚解决方法

发布时间: 2012-04-28 11:49:53 作者: rapoo

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,如果使用的是注解,该类是否加上相关注解。希望能帮上楼主忙。

读书人网 >Java Web开发

热点推荐