Working with jOOQ and Flyway using Testcontainers
Table of contents
Generate typesafe jOOQ code from a real PostgreSQL database managed by
Flyway migrations, then test repositories using Testcontainers.
Time to complete
25 minutes
In this guide, you will learn how to:
- Create a Spring Boot application with jOOQ support
- Generate jOOQ code using Testcontainers, Flyway, and a Maven plugin
- Implement basic database operations using jOOQ
- Load complex object graphs using jOOQ's MULTISET feature
- Test the jOOQ persistence layer using Testcontainers
Prerequisites
- Java 17+
- Maven
- A Docker environment supported by Testcontainers
NoteIf you're new to Testcontainers, visit the Testcontainers overview to learn more about Testcontainers and the benefits of using it.
Modules
- Create the project
Set up a Spring Boot project with jOOQ, Flyway, PostgreSQL, and Testcontainers code generation.
- Write tests
Test jOOQ repositories using Testcontainers with the @JooqTest slice and @SpringBootTest.
- Run tests
Run the jOOQ and Flyway integration tests and explore next steps.