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); }
Hello Mis,
Have you tried calling methods on the entityManger directly (close, open etc)? Of course your objects will become detached and you will need to merge them into the new session.
Regards,
Ingo