数据库是mysql,表类型是InnoDB,安装版。不说废话直接贴图。
工程结构图:

控制层:

逻辑层,实现类和接口:

接口

spring、hibernate整合配置文件;


控制层调用逻辑层,第一个save方法正常进库,到第二个add方法之前有个空指针,正常事务是应该回滚的,第一条数据是不应该进库的对吧,高手们,本人这么想有错吗?或是本人的配置有问题,求指导,真的非常感谢!
工程结构图:

控制层:

逻辑层,实现类和接口:

接口

spring、hibernate整合配置文件;


控制层调用逻辑层,第一个save方法正常进库,到第二个add方法之前有个空指针,正常事务是应该回滚的,第一条数据是不应该进库的对吧,高手们,本人这么想有错吗?或是本人的配置有问题,求指导,真的非常感谢!
解决方案:10分
在datasource 里面配置 <property name=”defaultAutoCommit” value=”false” /> 取消数据库自动提交的功能
解决方案:10分
抛出的异常都捕获了,莫阿斯是不能回滚事务。可以试试抛出去throw exception。试试吧!
解决方案:20分