When ORM Becomes OMG: Performance Pitfalls in JPA and Friends
summary
A demo funfact store uses Java 25, Spring Boot 4, Spring Data JPA, Hikari and Postgress with Testcontainers and a unit test that measures real effects. Connection pooling is 4,000× faster than DriverManager and Hikari defaults to max pool size 10. Leaving spring.jpa.open-in-view=true keeps connections during view rendering and increases latency from ~654 ms to 263 ms then to ~14 ms after disabling open‑in‑view and adjusting autocommit. Fixes include DTO projections or join‑fetch to avoid N+1 and using TransactionTemplate to keep connections held for the shortest time.
AI-written summary · about
chapters (10)
- 0:00Introduction
- 2:17Client app and server setup
- 3:19Connection pools for DB
- 7:10Optimizing Spring Boot connections
- 13:55Debugging Hibernate timing
- 23:50JPA and Hibernate basics
- 27:23Lazy vs eager fetching
- 36:36DTO projections
- 43:50JPA mappings best practices
- 48:39Future plans for Fun Fact Store
related talks
45mWhen ORM Becomes OMG: Performance Pitfalls in JPA and Friends
47mWhen ORM Becomes OMG: Performance Pitfalls in JPA and Friends
44mPerformance oriented Spring Data JPA & Hibernate
49mPerformance oriented Spring Data JPA & Hibernate
46mMastering JPA Performance
44mORM Insights - How not to hurt yourself?
52mJava Persistence and Hibernate Tips that can boost up your application performance
46mThe State of Java Relational Persistence
