随笔-61  评论-159  文章-0  trackbacks-0
Spring 整合 Hibernate 的一处简化配置
原文:http://www.blogjava.net/steady/archive/2007/08/17/137527.html

在过去使用 Spring 整合 Hibernate 的时候,都是用这样的配置方式。

<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>

每当需要加入一个新的 VO 时,我需要过来修改配置文件,来引入对新的 VO 的支持。

现在我使用的时候,是这么配的:
<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>

做项目开发的时候,就再也没有改过配置。

-------------------------------------------------------------------------------------------------
PS:本博客文章,如果没有注明是有“转”字样,属于本人原创。如果需要转载,务必注明作者文章的详细出处地址,否则不允许转载,多谢合作!
posted on 2007-09-20 18:49 apple0668 阅读(388) 评论(0)  编辑  收藏 所属分类: springhibernate

只有注册用户登录后才能发表评论。


网站导航: