CQRS in the small with Java Records and jOOQ
summary
Explains how CQRS maps to a single-database Java app using Java Records for immutable commands, sealed interfaces and pattern matching for exhaustive handlers, and jOOQ to read nested trees with its jOOQ multiset (JSON/JSONB) output instead of Hibernate entities. Demo uses Spring Boot, Flyway, testcontainers, and ~10,000 orders; reads execute as one complex SQL instead of thousands of lazy loads, trading JSONB processing cost for far fewer queries.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 0:28About me
- 0:49Presentation
- 2:20Mapping Waterfall
- 9:26Over fetching
- 10:29Under fetching
- 11:37CQRS
- 14:41Java Records
- 16:24Other features
- 21:59jOOQ
- 22:58compiletime failures
- 23:39why CQRS
- 25:43how CQRS works
- 32:13sample query
- 34:22construct query
- 37:39conclusion
- 43:04unit testing








