Most developers learn JPA by copying annotations until the tests pass. This book teaches you what actually happens how the persistence context tracks state, why flush timing matters, what queries Hibernate generates and when, and how to build systems that stay fast as data grows.
Written for developers who have used Hibernate but want to understand it, the book works through 28 progressive chapters using a single domain — a streaming platform called CineTrack — so every concept builds on real code rather than contrived examples.
You will learn how the entity lifecycle drives every decision Hibernate makes, how to map complex types including JSONB, arrays, and custom Hibernate types, and why collection mapping choices ripple through query performance.
The book covers optimistic and pessimistic locking in depth, explains the N+1 problem from first principles, and shows batch processing patterns that handle millions of rows without running out of memory.
Later chapters move beyond the basics: second-level caching with Caffeine, multi-tenancy with schema isolation, audit history with Hibernate Envers, full-text search with Hibernate Search 8, reactive access with R2DBC, and production observability with Micrometer and slow query logging.
Every chapter includes working code with real PostgreSQL 16, enforced by Testcontainers integration tests. There are no in-memory databases and no mocked repositories.
The examples behave exactly as they would in production.