论坛首页 入门技术论坛

ApplicationContext.xml - sessionFcatory 配置详解

浏览 2229 次
该帖已经被评为新手帖
作者 正文
   发表时间:2010-01-15  
<bean id="sessionFactory"		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
	<property name="dataSource">
		<ref local="dataSource" />
	</property>
	<property name="hibernateProperties">
		<props>
                        <!-- 缓存策略 -->
			<prop key="hibernate.cache.provider_class">
				net.sf.ehcache.hibernate.SingletonEhCacheProvider
			</prop>
                        <!-- 数据库方言 -->
			<prop key="hibernate.dialect">
				org.hibernate.dialect.Oracle10gDialect
			</prop>
                        <!-- 查询缓存 -->
			<prop key="hibernate.cache.use_query_cache">true</prop>
                        <!-- 二级缓存 -->
			<prop key="hibernate.cache.use_second_level_cache">
				false
			</prop>
                        <!-- 显示SQL -->
			<prop key="hibernate.show_sql">true</prop>
                        <!-- 格式化SQL -->
			<prop key="hibernate.format_sql">false</prop>
                        <!-- 查询返回记录条数 -->
			<prop key="hibernate.jdbc.fetch_size">50</prop>
                        <!-- 批处理条数 -->
			<prop key="hibernate.jdbc.batch_size">30</prop>
			<prop key="hibernate.query.factory_class">
				org.hibernate.hql.classic.ClassicQueryTranslatorFactory
			</prop>
		</props>
	</property>
        <!-- 导入配置文件 -->
	<property name="configLocation"
		value="classpath:dte2_hibernate.cfg.xml" />
                <!-- 以包为单位读取影射BEAN信息 -->
		<property name="mappingDirectoryLocations">
		<list>
			<value>classpath:com/asc/olvenv/</value>
		</list>
	</property>
</bean>
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics