CQRS in the Small with Java Records and jOOQ
summary
Demo application on GitHub shows CQRS applied on one Postgres database using Spring Boot, Flyway and jOOQ to model Java Records for immutable commands and return nested read models with a jOOQ multiset JSON query. Traditional JPA flow suffers N+1 and takes ~3s for the sample request; the jOOQ CQRS version issues one SQL and drops to ~1.5s while removing MapStruct mapping. Generation uses a testcontainers jOOQ generator that spins the DB and produces the meta model automatically.
AI-written summary · about
chapters (15)
- 0:00Introduction
- 1:15The problem with rest
- 2:52Traditional architecture
- 4:32Demo application setup
- 7:12Performance issues
- 9:40Over-fetching issues
- 11:58CQRS fundamentals
- 14:13Modern Java features
- 18:46Command implementation
- 20:52Introduction to jOOQ
- 26:16jOOQ setup and generation
- 31:06jOOQ in practice
- 35:37Query optimization
- 39:04Conclusion and benefits
- 40:27Q&A








