Hi all !
I'm using Hibernate to update a Database schema and invoke some Stored Procedures.
I can see that when I issue commit(), then the Session is closed, as a matter of fact If I issue
session.close() afterwards, I'll get an error "Session is closed!".
Is it configurable to close() the session with/without commit() ?
Here's an example:
Code:
Session session = SessionFactoryUtil.getSessionFactory().getCurrentSession();
String toReturn = null;
CallableStatement cs = null;
try {
session.beginTransaction();
cs = session.connection().prepareCall("{call prc_insert_voip(?)}");
cs.setLong(1, idSubnetting);
cs.execute();
session.getTransaction().commit();
}
catch (Exception exc) {
exc.printStackTrace();
}
finally {
try {
cs.close();
// THIS ISSUES AN ERROR "Session is closed"
session.close();
} catch (SQLException e) {
e.printStackTrace();
}
session.close();
}
Thanks a lot
John