title: Does Hibernate's Session.close() automatically rollback uncommitted transactions?
body: <p>I'm reading the Hibernate documentation at present and I came across the following quote:</p>
  
  <blockquote>
    <p>If the Session throws an exception, including any SQLException, immediately rollback the database transaction, call Session.close() and discard the Session instance. Certain methods of Session will not leave the session in a consistent state. No exception thrown by Hibernate can be treated as recoverable. Ensure that the Session will be closed by calling close() in a finally block. </p>
  </blockquote>
  
  <p>This all makes sense as far as I'm concerned, but it does make me wonder what the effect of closing a session is with a transaction neither committed nor rolled back? </p>
  
  <p>E.g consider the following:</p>
  
  <pre><code>  session = getSessionFactory().openSession();
    session.beginTransaction();
    session.save(carObject);
    //session.getTransaction().commit();
    session.close();
  </code></pre>
  
  <p>With commit commented out, and no rollback called here, what is the expected behaviour of session.close()? Does it simply rollback that commit automatically, does it leave a 'hanging' transaction? etc.</p>
  
  <p>(I understand this obviously wouldn't be good practice - I'm just trying to get my head around the underlying concepts a bit more.)</p>