1 Reply Latest reply on Jul 31, 2009 3:00 AM by joblini

    EntityManager keeps connection open for the whole duration of @WebRemote call

    mistigi

      I have a webservice component in my seam application that is being called from an outside of the application.


      The component queries a database and then is making and external webservice call itself to a remote server.


      My problem is that for the whole duration of the method entityManager is holding onto the database connection. Its not returned to the database connection pool. What can I do to force it to return connection to the pool and get it again when its needed ?




      @WebMethod
      public void doCall(...){
           CallDesc callDesc = entityManager.createQuery("from URL url where...").getSingleResult();
      
           HttpClient client=new HttpClient(callDesc.getURL());
           HttpResult result=client.doGet(); //possibly a very long operation
      
           callDesc.setResponseCode(result.getResponseCode());
           em.persist(callDesc);
      }