日期:2014-05-17  浏览次数:20798 次

spring 多数据源 sessionFactiory只加载了一个
请教大虾们,我按照网上前辈们经验配置了ssh多数据源,结果启动tomcat时sessionFactiory里的hibernate.hbm.xml文件只加载了一个sessionFactiory里的,另一个没加载。为什么啊。

上段代码
<?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: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/tx 
     http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
     http://www.springframework.org/schema/aop 
     http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">

  <bean id="rdataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
       <property name="driverClassName"><value>oracle.jdbc.driver.OracleDriver</value></property>
       <property name="url"><value>jdbc:oracle:thin:@10.103.2.10:1521:SW01</value></property>
       <property name="username"><value>system</value></property>
       <property name="password"><value>manager</value></property>
  </bean>
  
  <bean id="wdataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
       <property name="driverClassName"><value>oracle.jdbc.driver.OracleDriver</value></property>
       <property name="url"><value>jdbc:oracle:thin:@10.103.2.102:1521:SW01</value></property>
       <property name="username"><value>system</value></property>
       <property name="password"><value>manager</value></property>
  </bean>
    
  <bean id="rsessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
        <ref bean="rdataSource"/>
    </property>