日期:2014-05-16 浏览次数:20490 次
<bean id="jotm" class="org.springframework.transaction.jta.JotmFactoryBean" /> <bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> <property name="userTransaction" ref="jotm" /> <property name="allowCustomIsolationLevels" value="true"></property> </bean>
//1号数据库 <bean id="dataSource1" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource" destroy-method="shutdown"> <property name="dataSource"> <bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown"> <property name="transactionManager" ref="jotm" /> <property name="driverName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://127.0.0.1:3306/db1?characterEncoding=utf-8" /> </bean> </property> <property name="user" value="root" /> <property name="password" value="" /> </bean> //2号数据库 <bean id="dataSource2" class="org.enhydra.jdbc.pool.StandardXAPoolDataSource" destroy-method="shutdown"> <property name="dataSource"> <bean class="org.enhydra.jdbc.standard.StandardXADataSource" destroy-method="shutdown"> <property name="transactionManager" ref="jotm" /> <property name="driverName" value="com.mysql.jdbc.Driver" /> <property name="url" value="jdbc:mysql://127.0.0.1:3306/db2?characterEncoding=utf-8" /> </bean> </property> <property name="user" value="root" /> <property name="password" value="" /> </bean>
//1号SessionFactory <bean id="sessionFactory1" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> </props> </property> <property name="dataSource" ref="dataSource1" /> <property name="packagesToScan" value="com.yuce.test.entity"/> </bean> //2号SessionFactory <bean id="sessionFactory2" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> </props> </property> <property name="dataSource" ref="dataSource2" /> <property name="packagesToScan" value="com.yuce.test.entity"/> </bean>
xapool.jar jotm-core.ja