1.<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
2. <property name="dataSource">
3. <ref local="dataSource" />
4. </property>
5. <property name="hibernateProperties">
6. <props>
7. <!-- 缓存策略 -->
8. <prop key="hibernate.cache.provider_class">
9. net.sf.ehcache.hibernate.SingletonEhCacheProvider
10. </prop>
11. <!-- 数据库方言 -->
12. <prop key="hibernate.dialect">
13. org.hibernate.dialect.Oracle10gDialect
14. </prop>
15. <!-- 查询缓存 -->
16. <prop key="hibernate.cache.use_query_cache">true</prop>
17. <!-- 二级缓存 -->
18. <prop key="hibernate.cache.use_second_level_cache">
19. false
20. </prop>
21. <!-- 显示SQL -->
22. <prop key="hibernate.show_sql">true</prop>
23. <!-- 格式化SQL -->
24. <prop key="hibernate.format_sql">false</prop>
25. <!-- 查询返回记录条数 -->
26. <prop key="hibernate.jdbc.fetch_size">50</prop>
27. <!-- 批处理条数 -->
28. <prop key="hibernate.jdbc.batch_size">30</prop>
29. <prop key="hibernate.query.factory_class">
30. org.hibernate.hql.classic.ClassicQueryTranslatorFactory
31. </prop>
32. </props>
33. </property>
34. <!-- 导入配置文件 -->
35. <property name="configLocation"
36. value="classpath:dte2_hibernate.cfg.xml" />
37. <!-- 以包为单位读取影射BEAN信息 -->
38. <property name="mappingDirectoryLocations">
39. <list>
40. <value>classpath:com/asc/olvenv/</value>
41. </list>
42. </property>
43.</bean>
ApplicationContext.xml - sessionFcatory 配置详解
最新推荐文章于 2025-05-13 16:25:22 发布