title: Hibernate statistics in spring boot not working?
body: <p>I have a small sample app here</p>
  
  <pre><code>https://github.com/jimbasilio/SpringBoot
  </code></pre>
  
  <p>that creates some simple data in the database and some other things I'm working on to kick the tires on spring boot (side note: so far i LOVE spring boot!!).  If you clone the git repo you can visit the url:</p>
  
  <pre><code>http://127.0.0.1:8080/hello/get/1
  </code></pre>
  
  <p>and it'll load from the database and write the hibernate statistics to the console.</p>
  
  <p>I do have a problem though, with or without configuring hibernate statistics via the application.properties file:</p>
  
  <pre><code>hibernate.generate_statistics=true
  </code></pre>
  
  <p>when i write the hibernate statistics out i get nothing useful.  I'm fetching the statistics via:</p>
  
  <pre><code>Session session = (Session) this.entityManager.getDelegate();
  session.getSessionFactory().getStatistics().logSummary();
  HelloEntity entity = helloRepository.findOne(id);
  entityManager.flush();
  session.getSessionFactory().getStatistics().logSummary();
  </code></pre>
  
  <p>my SECOND log message (after flush) is below.  You can see it doesn't even register sessions being opened.  I'm using spring boot 1.0.1.RELEASE.</p>
  
  <p>pom.xml </p>
  
  <pre><code>&lt;parent&gt;
      &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
      &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
      &lt;version&gt;1.0.1.RELEASE&lt;/version&gt;
  &lt;/parent&gt;
  </code></pre>
  
  <p>log file:</p>
  
  <pre><code>2014-04-28 20:51:29.415  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000161: Logging statistics....
  2014-04-28 20:51:29.416  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000251: Start time: 1398732682476
  2014-04-28 20:51:29.416  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000242: Sessions opened: 0
  2014-04-28 20:51:29.416  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000241: Sessions closed: 0
  2014-04-28 20:51:29.416  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000266: Transactions: 0
  2014-04-28 20:51:29.416  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000258: Successful transactions: 0
  2014-04-28 20:51:29.417  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000187: Optimistic lock failures: 0
  2014-04-28 20:51:29.417  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000105: Flushes: 0
  2014-04-28 20:51:29.417  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000048: Connections obtained: 0
  2014-04-28 20:51:29.417  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000253: Statements prepared: 0
  2014-04-28 20:51:29.417  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000252: Statements closed: 0
  2014-04-28 20:51:29.417  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000239: Second level cache puts: 0
  2014-04-28 20:51:29.418  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000237: Second level cache hits: 0
  2014-04-28 20:51:29.418  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000238: Second level cache misses: 0
  2014-04-28 20:51:29.418  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000079: Entities loaded: 0
  2014-04-28 20:51:29.418  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000080: Entities updated: 0
  2014-04-28 20:51:29.418  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000078: Entities inserted: 0
  2014-04-28 20:51:29.418  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000076: Entities deleted: 0
  2014-04-28 20:51:29.419  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000077: Entities fetched (minimize this): 0
  2014-04-28 20:51:29.419  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000033: Collections loaded: 0
  2014-04-28 20:51:29.419  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000036: Collections updated: 0
  2014-04-28 20:51:29.419  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000035: Collections removed: 0
  2014-04-28 20:51:29.419  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000034: Collections recreated: 0
  2014-04-28 20:51:29.420  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000032: Collections fetched (minimize this): 0
  2014-04-28 20:51:29.420  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000438: NaturalId cache puts: 0
  2014-04-28 20:51:29.420  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000439: NaturalId cache hits: 0
  2014-04-28 20:51:29.420  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000440: NaturalId cache misses: 0
  2014-04-28 20:51:29.420  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000441: Max NaturalId query time: 0ms
  2014-04-28 20:51:29.420  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000442: NaturalId queries executed to database: 0
  2014-04-28 20:51:29.420  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000210: Queries executed to database: 0
  2014-04-28 20:51:29.420  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000215: Query cache puts: 0
  2014-04-28 20:51:29.421  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000433: update timestamps cache puts: 0
  2014-04-28 20:51:29.421  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000434: update timestamps cache hits: 0
  2014-04-28 20:51:29.421  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000435: update timestamps cache misses: 0
  2014-04-28 20:51:29.421  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000213: Query cache hits: 0
  2014-04-28 20:51:29.421  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000214: Query cache misses: 0
  2014-04-28 20:51:29.421  INFO 18044 --- [nio-8080-exec-1] o.h.s.internal.ConcurrentStatisticsImpl  : HHH000173: Max query time: 0ms
  </code></pre>