hibernate4 通用dao,service

代码

web.xml记得加上

	<filter>
		<filter-name>openSessionInView</filter-name>
		<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>openSessionInView</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

 不然记得dao中的this.sessionFactory.getCurrentSession();会报错

猜你喜欢

转载自peak1992.iteye.com/blog/2356992