<?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>
一个系统,多个事务管理器
最新推荐文章于 2023-11-28 17:07:29 发布