I just followed a simple hibernate struts tutorial and succesfully made db calls through hibernate. However I don’t see the code closing the hibernate connection anywhere.
sessionFactory.getCurrentSession();
is used to get the session per request. Should I close this session when the user logs out? or after each request of is this something taken care of by the framework?
a second related question is, In what kind of use case would I use a hibernate session interceptor?
and a third question(sorry it just popped in my mind) what the best option for caching with hibernate/struts2?
Regarding the first question, the reference documentation says:
Regarding your second question, the documentation says:
Regarding the third question, Struts2 is a presentation framework. It has nothing to do with persistence and thus caching of the persistent entities. The documentation talks in details about the second-level cache.
As you see, the documentation has a whole lot of interesting information. I would advise reading it.