Search code examples
springsessionjpadwr

DWR + Spring + JPA Session Closed


Background

The application I am working on currently uses Spring + JPA. Everything was working fine before we decided to introduce DWR.

Using DWR I invoke a method on a Service class and it then redirects to the Controller.

try{
      return WebContextFactory.get()
                        .forwardToString("/search.do?searchString=" + searchString);
}catch(...){

}

After this, when the search method is invoked at the DAO, it does not find an pen session.

Session session = (Session) entityManager.getDelegate();

This session here is closed...

I think my changes(of introducing DWR) should not in any way affect the Session creation.

Awaiting inputs.

Shardul.


Solution

  • Issue resolved.

    The problem was with the configuration of OpenEntityManagerInViewFilter in the web.xml. It was not intercepting the DWR requests as it was mapped to a

    *.do

    instead of

    /*

    Shardul.