---
title: "hibernate annotations和hbm.xml配置文件并存配置"
author: "vivei"
date: "2011-11-25T10:17:53Z"
tags: []
categories: ["编程语言"]
slug: "hibernate-annotations-hbm-xml"
draft: false
lastmod: "2011-11-25T10:17:53Z"
id: 1277810
url: "https://vivei.iteye.com/blog/1277810"
---

[hibernate annotations和hbm.xml配置文件并存配置](http://blog.csdn.net/yuyangishere/article/details/5329586 "hibernate annotations和hbm.xml配置文件并存配置")

 

```
	<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
	    <property name="dataSource" ref="dataSource"/>
	    <property name="hibernateProperties">
	   		<props>
	   		 	<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
	   		 	<prop key="current_session_context_class">thread</prop>
 			    <!--
			    <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
			    <prop key="hibernate.cache.use_query_cache">true</prop>
 			    -->
			    <prop key="hibernate.show_sql">true</prop>
			    <prop key="hibernate.format_sql">true</prop>
			    <prop key="hibernate.hbm2ddl.auto">none</prop>
			    <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
			 </props>
	    </property>
        <property name="packagesToScan" value="com.*.dao.pojo.*" />
	    <property name="mappingResources">
	      <list>
	      	<!--
			<value>com/*/*/User.hbm.xml</value>
			-->
	      </list>
	    </property>
	</bean>	
```