标签:
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<!--<property name="configLocation" value="hibernate.cfg.xml"></property>--> (3)
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
</props>
</property>
<property name="packagesToScan" value="xxx.xxx" />
</bean>
上面的就是hibernate的sessionfactory的配置,其中最下面的</property>
<property name="packagesToScan" value="xxx.xxx" />
就是告诉hibernate在xxx.xxx这个包下去搜索注释生成数据库表
如果用(3)的配置就需要hibernate.cfg.xml
hibernate +spring sessionfactory 配置
标签:
原文地址:http://my.oschina.net/u/1778309/blog/375617