I am new in hibernate,after read the hibernate api and tutorial,it seems that the session should closed when not used.
Like this:
Session sess=getSe
If you are getting session through sessionFactory.openSession() then you have to close it externally. Opened session for unintended period can cause the data leaks. Plus it can give invitation to Web App security threat.
sessionFactory.openSession()