2011-08-25 115 views
0
 <bean id="ssoSessionFactory" 
      class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> 
      <property name="configLocation"> 
       <value>classpath:sso-hibernate.cfg.xml</value> 
      </property> 
      <property name="configurationClass"> 
       <value>org.hibernate.cfg.AnnotationConfiguration</value> 
      </property> 
this is the part im unsure of.... 
<property name="configfile"> 
       <value>classpath:sso-hibernate.properties</value> 
      </property> 
     </bean> 

我知道有至少有六種方法來做到這一點,但爲了我的需要,這將是最簡單的。什麼是將指定哪個hibernate.properties文件使用的屬性的語法?原因是這個應用程序可能最終會有大約5或6個同步數據庫連接,並且它們必須位於不同的文件中。這是什麼正確的語法

回答

0

我相信你正在尋找the hibernateProperties property,它允許你在工廠bean中設置一個Properties實例。由於春天的PropertyEditors的魔力,你可以只寫

<property name="hibernateProperties" value="classpath:sso-hibernate.properties"/> 
0

他們是使用hibernet.properties在answer on coderanch

這是一個很好的例子是聲明的豆

<bean id="hibernateConfigProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean"> 
    <property name="location"> 
     <value>classpath:hibernate.properties</value> 
    </property> 
</bean>