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

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类

                                                                                                                            载自:http://www.cnblogs.com/eafy