彼らは、ajaxを使用したhibernateとwebappのクローズドセッションはJavaとSpringの一般的な問題であると言っているので、このようにweb.xmlでOpenSessionInViewInFilterを設定する必要があります
<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>
しかし、それでも、Hibernate Criteria api を使用しようとすると、「Session is Closed」という休止状態の例外が発生するため、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">
そしてインターセプター
<bean id="openSessionInViewInterceptor"class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
同じ「セッションが閉じられている」問題。ここで私を助けてください。私はJavaが初めてなので、あなたの助けに感謝します。
現在、maven の jetty プラグイン、バージョン 6.1.10 内で実行しています。