I have written a code to connect to oracle database and retrieve some data. I opened session and close it properly but it is appearing that its not closing properly. I found it by query to get total in active sessions and its increasing which is very strange. My code to get data and to to query inactive sessions is as follows. Its appearing that session.close() function is not working but i don't know why? I am using Glassfish, JSF and 10g oracle database.
select count(s.status) INACTIVE_SESSIONS
from gv$session s, v$process p
where
p.addr=s.paddr and
s.status='INACTIVE';
public List<TrxTender> getFileDetails() {
java.util.List l = null;
try {
sess = sessFactory.openSession();
Query q = sess.createQuery("from mytable");
l = q.list();
return l;
} catch (HibernateException hbx) {
hbx.printStackTrace();
} finally {
sess.flush();
sess.close();
}
return l;
}