---
title: "在Spring中配置多个*.hbm.xml文件"
author: "Jseeker"
date: "2010-12-09T23:37:45Z"
tags: ["Bean", "Hibernate", "SQL", "Spring", "XML"]
categories: ["企业架构"]
slug: "spring-hbm-xml"
draft: false
lastmod: "2010-12-09T23:37:45Z"
id: 838100
url: "https://jseeker.iteye.com/blog/838100"
---

在Spring中配置多个\*.hbm.xml文件

```
<beans>
  <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
        <property name="dataSource">
            <ref bean="dataSource" />
        </property>
        <property name="hibernateProperties">
            <props>
                <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
                <prop key="hibernate.show_sql">false</prop>
                <prop key="hibernate.generate_statistics">true</prop>
                <prop key="hibernate.connection.release_mode">auto</prop>
                <prop key="hibernate.autoReconnect">true</prop>
            </props>
        </property>
	<property name="mappingLocations">
		<value>/WEB-INF/template/db/**/*.hbm.xml</value>
	</property>         
   </bean>
</beans>
```

 template文件夹下面的所有数据库映射文件会被加载。