I had a method doing a persist and a method doing a merge which I had surrounded with try and catch ... and of course with a finally block doing an em.close().
The problem was with the queries doing a .getSingleResult(). I forgot that these might throw the error in hand, and if they did, the closing of entitymanager wasn't done.
try {
Query query = em.createQuery("select query");
return query.getSingleResult();
} catch (NoResultException e) {
log.debug(e);
} catch (Exception e) {
log.error(e);
} finally {
em.close();
}
Ei kommentteja:
Lähetä kommentti
Huomaa: vain tämän blogin jäsen voi lisätä kommentin.