They say that a closed session in hibernate and webapp with ajax is a common problem with java and spring so I have to set the OpenSessionInViewInFilter in the web.xml like this
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
</param-value>
</context-param>
<filter>
<filter-name>springFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>springFilter</filter-name>
<url-pattern>/dwr/*</url-pattern>
</filter-mapping>
But even with that, I get the "Session is Closed" hibernate exception when I try to use Hibernate Criteria api, so I tried another spring way using OpenSessioninViewInterceptor
<bean id="urlMapping"
class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="alwaysUseFullPath" value="false"/>
<property name="mappings">
<props>
<prop key="*">dwrController</prop>
</props>
</property>
<property name="interceptors">
and the interceptor
<bean id="openSessionInViewInterceptor"class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
Same "Session is closed" problem. Please help me here. I am new in Java so your help is very much appreciated.
I am currently running inside maven's jetty plugin, version 6.1.10.