首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

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

2012-04-28 
spring3+mybatis事务不回滚Java codepublic void createMemberAccount(TbMemberAccount account,TbRegiste

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

热点排行