spring+hibernate+atomikos多数据源事务无法回滚
我用的框架是spring+hibernate+atomikos配置多数据源。applicationContext.xml配置文件如下
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" 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-3.0.xsd
http://www.springframework.org/schema/flex http://www.springframework.org/schema/flex/spring-flex-1.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd"
default-autowire="byName">
<!-- 使Spring关注Annotation -->
<context:annotation-config />
<bean id="BaseService" class="com.test.service.impl.BaseServiceImpl" />
<!-- 让Spring通过自动扫描来查询和管理Bean -->
<context:component-scan base-package="com.test">
<context:include-filter type="regex" expression=".dao.impl.*"/>
<context:include-filter type="regex" expression=".serviec.impl.*"/>
<context:include-filter type="regex" expression=".entity.*"/>
</context:component-scan>
<!-- 数据库tms -->
<bean class="com.atomikos.jdbc.AtomikosDataSourceBean" init-method="init" destroy-method="close"
id="tmsDataSource">
<!-- Set unique name for this DataSource -->
<property name="uniqueResourceName"><value>tms</value></property>
<!-- Set XADatasource class name-->
<property name="xaDataSourceClassName" value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" />
<property name="xaProperties">
<props>
<prop key="user">root</prop>
<prop key="password">root</prop>
<prop key="url">jdbc:mysql://localhost:3306/tms</prop>
</props>
</property>
<!-- set properties for datasource connection pool -->
<property name="poolSize" value="3" />
<!-- 管理 Connection 被占用的时间 -->
<!-- 如果不设置这个值,Atomikos使用默认的300秒(即5分钟),那么在处理大批量数据读取的时候,一旦超过5分钟,就会抛出类似 Resultset is close 的错误 -->
<property n