Issue
I have a doubt, using getCurrentSession of a sessionFactory, it generates many connections to the database.
when it reaches about 400 the application crashes:
href="https://i.stack.imgur.com/WuBEQ.png" rel="nofollow noreferrer">Crash
A typical method of a query by hibernate:
@Autowired
@Qualifier(value = "sessionFactory")
private SessionFactory sessionFactory;
try {
Session s = this.sessionFactory.getCurrentSession();
Query query = s.createQuery("from x where c.numFactura = :numFactura");
query.setParameter("numFactura", numFactura);
return query.uniqueResult();
} catch (Exception ex) {
throw ex;
}
I really don't know, if these events are connected, what do you think?
Solution
the problem wasn't there, I had a problem with the Jasper Reports DB Conection, fixed by autoclosing conection on timeout.
Answered By - Isaachjk
Answer Checked By - David Goodson (JavaFixing Volunteer)