title: Spring + Hibernate session lifecycle
body: <p>How properly "lifecycle" of a Hibernate session under Spring should be done?</p>
  
  <p>The <code>SessionFactory</code> is created automatically by Spring and is taking its DB connections from Glassfish connection pool. At the moment I am getting a Hibernate session via <code>SessionFactory.getCurrentSession()</code>. Then I start transaction, do the work and then <code>commit()</code> or <code>rollback()</code> at the end. Do I need to do any other actions like <code>disconnect()</code>, <code>close()</code>, <code>flush()</code> or any others at any time so connections would be properly returned back to the pool or is everything already automatically done by Spring? </p>
  
  <p>With plenty of these methods it is a little confusing for me at the moment to understand when what should be done, maybe someone can point to right direction?</p>