In my hibernate application I have written below code for saving EmployeeRegistration object into oracle db.
public Integer submitDetails(EmployeeRegistration es)
{
Session session = factory.openSession();
Transaction tx = null;
Integer employeeID = null;
try
{
tx = session.beginTransaction();
employeeID = (Integer)session.save(es);
session.flush();
tx.commit();
}
catch(HibernateException e)
{
if(tx != null)
{
tx.rollback();
}
e.printStackTrace();
}
finally
{
if(session.isOpen()) {
session.close();
}
}
return employeeID;
}
After closing session, it keeps inactive sessions in oracle db. I have checked the inactive session using the below query in oracle.
SQL> select USERNAME,COUNT(*) FROM V$SESSION WHERE STATUS='INACTIVE' GROUP BY USERNAME ;
How to kill all the inactive session through hibernate. Can anyone help me in resolving this issue.