Results 1 to 2 of 2

Thread: Is it possible to use OpenEntityManagerInViewInterceptor with spring-ws?

  1. #1
    Join Date
    Feb 2008
    Location
    London
    Posts
    4

    Default How can I keep the Hibernate's session open with spring-ws (in lazy loading mode)?

    Hi,

    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="org.springframework.orm.jpa.support.OpenEnt ityManagerInViewInterceptor">
    <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>

    <bean id="urlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="interceptors">
    <list><ref bean="openEntityManagerInViewInterceptor"/></list>
    </property>
    </bean>
    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="org.springframework.ws.server.endpoint.mapp ing.PayloadRootAnnotationMethodEndpointMapping"/>

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

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

    <bean id="identificationEndpoint" class="com.mycompany.ws.user.ws.IdentificationEndp oint"/>

    <!-- Dynamic WSDL generation -->
    <bean id="apiFontEnd" class="org.springframework.ws.wsdl.wsdl11.DynamicW sdl11Definition">
    <property name="builder">
    <bean class="org.springframework.ws.wsdl.wsdl11.builder. 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/"/>
    </bean>
    </property>
    </bean>

    ...
    I use Spring-ws 1.5.0 M2.

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

  2. #2
    Join Date
    Feb 2008
    Location
    London
    Posts
    4

    Default Any idea?

    I tried to use "org.springframework.orm.jpa.support.OpenEntityMan 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:

    http://www.jroller.com/kbaum/date/20050406

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •