Spring 下hibernate多模块应用中多个hibernate.cfg.xml文件配置
Spring 下hibernate多模块应用中如何支持多个hibernate.cfg.xml文件配置呢?
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="configLocations">
<list>
<value>classpath:hibernate.cfg.xml</value>
<value>classpath:hibernate-co.cfg.xml</value>
</list>
</property>
......
或者见这里
public void setConfigLocations(Resource[] configLocations)
- Set the locations of multiple Hibernate XML config files, for example as classpath resources "classpath:hibernate.cfg.xml,classpath:extension.cfg.xml".
-
Note: Can be omitted when all necessary properties and mapping resources are specified locally via this bean.
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
- <property name="configLocations">
- <value>classpath:hibernate.cfg.xml,classpath:hibernate-co.cfg.xml
- </value></property>
......