spring3+hibernate4出错解决方法如下:在web.xml添加如下配置即可
<!-- openSessionInView配置 -->
<filter>
<filter-name>openSessionInViewFilter</filter-name>
<filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>openSessionInViewFilter</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
还有spring配置hibernate的SessionFactory
<prop key="hibernate.current_session_context_class">thread</prop>
最后 事务管理很重要也可能是没有事务管理找不到相应的事务出错