title: Spring Data JPA with Hikari: Why is hikari auto-commit property set to 'true'?
body: <p>Spring Data JPA or Hibernate have by default auto-commit set to false. This sounds reasonable as these frameworks work with entities and an update to an entity could involve updates to multiple tables through multiple SQL queries. So by setting auto-commit to false and explicitly controlling a transaction these frameworks ensure that a change to entity is atomic and consistent.</p>
  <p>But now Hikari is the default connection pool provider for spring data jpa, and on looking at application logs I see hikari sets auto-commit to true for the connection pool.</p>
  <pre><code>2021-10-24 11:30:07.815 DEBUG   [restartedMain] com.zaxxer.hikari.HikariConfig||HikariConfig.logConfiguration:1135: autoCommit................................true
  </code></pre>
  <p>Any explanation of why this is set so and does this effect transactions(I don't think it effects transactions as each transaction might again set auto-commit to false and thus take over when to commit the transaction.)</p>
  <p><strong>Edit - following @ken-chan answer and discussion.</strong><br />
  For projects using spring data jpa with @Transactional (with 100% Hiberante), changing hikaris connection pool settings to <code>auto-commit=false</code> should give performance benefit. Please see answer and subsequent discussion for more details.</p>