No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional
위와 같은 에러가 뜬다면 많은 이유가 있겠지만 그 이유는 중 하나이다.
해결방법은 2가지가 있다.
첫번째
this.mSessionFactory.getCurrentSession()
위와 같이 쓰고 있다면
this.mSessionFactory.openSession()
으로 바꾸어서 써라
두번째 방법
web.xml에서 아래의 코드를 추가해라
<filter>
<filter-name>HibernateSession</filter-name>
<filter-class>
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>HibernateSession</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
이유는..
The reason behind this issue is hibernate session is not bound with HTTP request by deafult. You have to bind it. So whether you open it directly or use spring provided interceptor
하이버네이트의 경우 HTTP Reuest에 대해서는 기본적으로 Bound하지 않는다고 한다. 그래서 이것을 스프링이 처리할수 있도록 바인딩 하거나 직접 Open으로 처리를 하도록 해야한다.??
'Development > Web & Server' 카테고리의 다른 글
[Javascript] 객체 내부에서 내부로 값을 전달 할때.. (0) | 2013.10.17 |
---|---|
[Spring Framework] Session값 사용하기 (0) | 2013.10.16 |
[Spring Framework] JSP에서 한글이 깨질때~! (0) | 2013.10.15 |
[Spring Framework] Hibernate 사용시 에러.. (0) | 2013.10.15 |
[Maven] cannot read zip file entry 오류 일때... (0) | 2013.10.14 |