title: In JDBC, when autocommit is false and no explicit savepoints have been set, is it good style or a waste to rollback?
body: <p>Say you have the following code:</p>
  
  <pre><code>Connection conn;
  try
  {
     conn = ... // get connection
     conn.setAutoCommit(false);
  
     ... // Do some modification queries and logic
  
     conn.commit()
  } catch(SQLException e)
  {
      conn.rollback() // Do we need this?
      conn.close()
  }
  </code></pre>
  
  <p>In this code, if there is an exception, is it better style to just close the connection (since autocommit is off), or to explicitly roll back and then close the connection? There are no save points.</p>
  
  <p>I feel that it might make sense to add the rollback call because:</p>
  
  <p>1) Someone, in the future, might add save points but forget to add the rollback</p>
  
  <p>2) It improves readability</p>
  
  <p>3) It shouldn't cost anything, right ? </p>
  
  <p>But obviously, none of these is particularly compelling. Any standard practice? </p>
  
  <p>Note: I'm aware of the need to do a repeat try/catch on closing and rollback. I actually have a middleware that abstracts the database access and takes care of that, but I was wondering whether adding it was superfluous.</p>