Spring + Hibernate session management
- by toc777
I have been reading about using Spring with Hibernate and I am really confused about session management. Hopefully someone can clear a few things up for me,
First of all I have no idea how sessions are managed when using HibernateTemplate. Is a session opened and closed when you call a method Eg Save() on the template? When you use the find() method, are detached objects returned?
I have read the Spring section on transactions but it mostly talks about handling exceptions. I was hoping to find some way of binding a hibernate session to a Spring transaction so that I can commit changes to hibernate objects when the transaction finishes. Is there a way to achieve this?