当前位置:编程学习 > JAVA >>

SSH问题,急急急急

异常No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
at org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:591)
at com.MR.imp.PersonDAOImpl.save(PersonDAOImpl.java:24)
at com.MR.test.TestMain.main(TestMain.java:22) --------------------编程问答-------------------- 在web.xml中加入<filter>
<filter-name>openSessionInView</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sf</param-value>
</init-param>
</filter>

<filter-mapping>
<filter-name>openSessionInView</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>,当然是在struts2的配置前面,原因你自己google有关opensessioninView你就知道了 --------------------编程问答-------------------- 我没用struts2啊!! --------------------编程问答-------------------- 那你打个SSH为啥?那你解释SSH是什么?struts没影响,只要有spring就能像我那样配置,如果没有用,你就google一下,hibernate的opensessioninView问题,你就知道为啥了 --------------------编程问答-------------------- 加我QQ852100921,帮我瞧哈代码,行不?
补充:Java ,  Java EE
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,