Announcement Announcement Module
No announcement yet.
Is it possible to use OpenEntityManagerInViewInterceptor with spring-ws? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Is it possible to use OpenEntityManagerInViewInterceptor with spring-ws?


    First of all congratulation for spring-ws which increased my productivity a lot.

    I use Hibernate implementation of JPA. My application need to keep the session open when Hibernate uses the lazy loading mode. I carefully read the Spring documentation, there is a solution which consist to pass an instance of 'OpenEntityManagerInViewInterceptor' in the 'SimpleUrlHandlerMapping' bean, as following:
    <bean id ="openEntityManagerInViewInterceptor" class=" ityManagerInViewInterceptor">
    <property name="entityManagerFactory" ref="entityManagerFactory" />

    <bean id="urlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="interceptors">
    <list><ref bean="openEntityManagerInViewInterceptor"/></list>
    However in the context file of my web service I do not use 'SimpleUrlHandlerMapping'. I do not need this as I use 'PayloadRootAnnotationMethodEndpointMapping'.

    How can I keep the hibernate session open for a thread with spring-ws?

    Please find below an extract of the context file:

    <!-- It detects and handles the mappings with @PayloadRoot annotations in the Endpoints -->
    <bean class=" ing.PayloadRootAnnotationMethodEndpointMapping"/>

    <!-- We use JAXB as Object/XML mapper (OXM) -->
    <bean id="marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshalle r">
    <property name="contextPath" value=""/>

    <!-- It converts the incoming XML messages to marshalled objects used as parameters and return value -->
    <bean class=" ter.GenericMarshallingMethodEndpointAdapter">
    <constructor-arg ref="marshaller"/>

    <bean id="identificationEndpoint" class=" oint"/>

    <!-- Dynamic WSDL generation -->
    <bean id="apiFontEnd" class=" sdl11Definition">
    <property name="builder">
    <bean class=" XsdBasedSoap11Wsdl4jDefinitionBuilder">
    <property name="schema" value="/WEB-INF/classes/xsd/sUser_ApiFontEnd.xsd"/>
    <property name="portTypeName" value="sUserApiFrontEnd"/>
    <property name="locationUri" value="http://localhost:8080/sUser-1.0-SNAPSHOT/"/>

    I use Spring-ws 1.5.0 M2.

    Thanks for your help.
    Last edited by alex.arica; Feb 27th, 2008, 04:05 PM.

  • #2
    Any idea?

    I tried to use " agerInViewFilter" in the file "web.xml". It does not work neither.

    There is an interesting article which explain how to do it with using servlet but there is not any doc with the spring-ws style mapper: