Here is my code, which using connections
Code:
public List getBudgets(Date dateBeg, Date dateEnd) {
List budgets = new ArrayList<Budget>();
Session session =null;
try {
session = HibernateUtil.getSessionFactory().openSession();
Criteria crit = session.createCriteria(Budget.class).add(Restrictions.between("period",dateBeg, dateEnd));
budgets.addAll(crit.list());
} catch (Exception e) {
e.printStackTrace();
} finally {
if (session != null && session.isOpen()) {
session.close();
}
}
return budgets;
}
Calling this function several times stops pool.
As I can understand
session.close(); method must return connection to pool?
Every time function executes - the number of recordset of the statement
select * from v$session decrements by 1. When this recordset becomes empty the pool stops.
What is wrong in my function? session = HibernateUtil.getSessionFactory().
openSession();?
When I used this code without pooling it worked all right!
Thanks