在过去使用 Spring 整合 Hibernate 的时候,都是用这样的配置方式。
每当需要加入一个新的 PO 时,我需要过来修改配置文件,来引入对新的 PO 的支持。
现在我使用的时候,是这么配的:
<
bean
id
="sessionFactory"
lazy-init
="true"
class ="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
< property name ="mappingResources" >
< list >
< value > resources/icustomer/Contact.hbm.xml </ value >
< value > resources/icustomer/Customer.hbm.xml </ value >
</ list >
</ property >
.
</ bean >
class ="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
< property name ="mappingResources" >
< list >
< value > resources/icustomer/Contact.hbm.xml </ value >
< value > resources/icustomer/Customer.hbm.xml </ value >
</ list >
</ property >
![](https://i-blog.csdnimg.cn/blog_migrate/9b8a8a44dd1c74ae49c20a7cd451974e.gif)
</ bean >
每当需要加入一个新的 PO 时,我需要过来修改配置文件,来引入对新的 PO 的支持。
现在我使用的时候,是这么配的:
<
bean
id
="sessionFactory"
lazy-init
="true"
class ="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
< property name ="mappingLocations" >
< list >
< value > classpath:resources/**/*.hbm.xml </ value >
</ list >
</ property >
.
</ bean >
class ="org.springframework.orm.hibernate3.LocalSessionFactoryBean" >
< property name ="mappingLocations" >
< list >
< value > classpath:resources/**/*.hbm.xml </ value >
</ list >
</ property >
![](https://i-blog.csdnimg.cn/blog_migrate/9b8a8a44dd1c74ae49c20a7cd451974e.gif)
</ bean >