Hibernate performance tuning
summary
Hands‑on recipe for fixing real Hibernate bottlenecks with runnable examples on GitHub: measure with JMH and Hibernate statistics, capture SQL with p6spy or datasource‑proxy and a counting interceptor, and write tests that assert exact query counts (example: 10 clients/13 accounts produced 11 queries). Tactics include fetch join and entity graphs to remove N+1, JDBC batching and batch‑fetching (batch size pitfalls explained), connection‑pool choice, second‑level cache tradeoffs, ID generator strategies and when to use stateless sessions or read‑only transactions.
AI-written summary · about
chapters (11)
- 0:00Introduction
- 3:21What is Hibernate
- 6:11Measuring performance
- 12:34JDBC-level tuning
- 16:25N+1 query problem
- 27:10Batch operations and flushing
- 32:15Second-level cache
- 39:06Query optimization
- 43:08Entity alternatives
- 47:42ID generation and load
- 51:19Summary and resources
related talks
52mJava Persistence and Hibernate Tips that can boost up your application performance
46mMastering JPA Performance
44mPerformance oriented Spring Data JPA & Hibernate
49mPerformance oriented Spring Data JPA & Hibernate
44mORM Insights - How not to hurt yourself?
58mCause of Death: Hibernate.
53mHibernate you know it… but actually you don’t
45mWhen ORM Becomes OMG: Performance Pitfalls in JPA and Friends
