`

hibernate annotations和hbm.xml配置文件在spring中的并存配置

阅读更多

因为整合了不同的系统,一套系统使用的是hibernate annotation,另一套系统使用的是hbm.xml

偷懒不想重构,又不想修改太多,所以决定整合hibernate annotations和hbm.xml



<bean id="sessionFactory" 
        class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">  
        <property name="dataSource" ref="dataSource" />  
        <property name="mappingResources">  
            <list>  
                <value>cn/com/iolog/model/User.hbm.xml</value> 
                <value>...</value> 
            </list>  
        </property>  
          
        <property name="annotatedClasses">  
            <list>  
                <value>com.iolog.newcentury.model.user.User</value>  
                <value>...</value> 
            </list>  
        </property>  
         .......
  </bean>


<property name="mappingResources">指定映射文件
<property name="annotatedClasses">指定annotation类
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics