一个系统,多个事务管理器

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!--jdbc数据连接池访问配置,一般在非本地开发环境
	<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
		<property name="jndiName">
			<value>jdbc/tamcx</value>
		</property>
	</bean>
-->

<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> 
		<property name="driverClassName"><value>com.informix.jdbc.IfxDriver</value></property>
		<property name="url"><value></value></property>
		<property name="username">
			<value>informix</value>
		</property>
		<property name="password">
			<value>informix</value>
		</property>
		<property name="maxIdle"> 
			<value>2</value>
		</property>
		<property name="maxActive">
			<value>5</value>
		</property>
		<property name="maxWait">
			<value>10000</value>
		</property>
		<property name="removeAbandoned">
			<value>true</value>
		</property>
		<property name="removeAbandonedTimeout">
			<value>30</value>
		</property>
	<property name="validationQuery">
         <value>select count(*) from t_role</value>
        </property>
     </bean>
     
<bean id="jdbcTransactionManager"
class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="JdbcTransactionProxyFactoryBean" lazy-init="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager">
			<ref bean="jdbcTransactionManager" />
		</property>
		<property name="transactionAttributes">
			<props>
	        <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
	        <prop key="*">PROPAGATION_REQUIRED</prop>
	        <prop key="exeSql">PROPAGATION_REQUIRED,-HsException</prop>
			</props>
		</property>
	</bean> 

<!-- hibernate数据访问配置-->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref local="dataSource" />
		</property>
		<property name="configLocation">
			<value>hs.cfg.xml</value>
		</property>
		<!-- jdk1.5支持
		<property name="configurationClass">
			<value>org.hibernate.cfg.AnnotationConfiguration</value>
		</property>
		-->
	</bean>
<bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>
<bean id="HibernateTransactionProxyFactoryBean" lazy-init="true" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
		<property name="transactionManager">
			<ref bean="hibernateTransactionManager" />
		</property>
		<property name="transactionAttributes">
			<props>
	        <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
	        <prop key="*">PROPAGATION_REQUIRED</prop>
	         <prop key="saveObjAndExeHql">PROPAGATION_REQUIRED,-HsException</prop>
			
			</props>
		</property>
	</bean>

<!-- JDBC公共数据访问-->
<bean id="jdbcDaoImplBS" class="com.hundsun.tamcx.database.JdbcDaoImpl">
<property name="dataSource" ref="dataSource" />
	</bean>

<bean id="jdbcDaoImplBSProxy" parent="JdbcTransactionProxyFactoryBean">
		<property name="target">
			<ref local="jdbcDaoImplBS" />
		</property>
	</bean>
	
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">  
	    <property name="configLocation" value="classpath:configuration.xml" />  
	    <property name="dataSource" ref="dataSource" />  
</bean>  
 
<!-- hibernate公共数据访问-->
<bean id="hibernateDaoImplBS" class="com.hundsun.tamcx.database.HibernateDaoImpl">
		<property name="sessionFactory">
			<ref local="sessionFactory" />
		</property>
	</bean>
<bean id="hibernateDaoImplBSProxy" parent="HibernateTransactionProxyFactoryBean">
		<property name="target">
			<ref local="hibernateDaoImplBS" />
		</property>
	</bean>
</beans>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值