当前位置: 代码迷 >> Web前端 >> webwork2.2.4+hibernate3.5.5+spring3.0.4整合有关问题相关(一)
  详细解决方案

webwork2.2.4+hibernate3.5.5+spring3.0.4整合有关问题相关(一)

热度:878   发布时间:2012-11-03 10:57:43.0
webwork2.2.4+hibernate3.5.5+spring3.0.4整合问题相关(一)
选择使用annotation配置,减少xml的编写!

spring组件查询包
<context:component-scan base-package="com.easyway" />


配置sessionFactory
<bean id="sessionFactory"
		class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="namingStrategy">
			<bean class="org.hibernate.cfg.ImprovedNamingStrategy"></bean>
		</property>
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">${hibernate.dialect}</prop>
				<!-- <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> <prop 
					key="max_fetch_depth">${hibernate.max_fetch_depth}</prop> <prop key="jdbc.fetch_size">${hibernate.jdbc.fetch_size}</prop> 
					<prop key="use_outer_join">${hibernate.use_outer_join}</prop> <prop key="hiberante.hbm2ddl.auto">update</prop> -->
				<prop key="hibernate.cache.provider_class">
					net.sf.ehcache.hibernate.EhCacheProvider
              </prop>
				<prop key="hibernate.cache.use_query_cache">true</prop>
			</props>
		</property>
		<property name="packagesToScan" value="com.easyway.model.entity"></property>
	</bean>

这里需要注意的是ehcache的配置 貌似使用annotation就需要配置ehcache,不然会报错!
还有要注意ehcache的版本

可能会提示需要下面的jar包
backport-util-concurrent-3.0.jar
  相关解决方案