<< 3.4.3 理解数据仓库中的元数据 - 51CTO.COM | 首页 | 微博配图,你最习惯到哪找素材? - 知乎 >>

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>

        ......

 

 

 

 

标签 : , ,



发表评论 发送引用通报