Spring Boot with jOOQ and PostgreSQL
4 min readNov 21, 2022
In this story, we’ll implement a sample REST API that uses Spring Boot with jOOQ and PostgreSQL.
Prerequisites
This is the list of all the prerequisites for following this story:
- Spring Boot 2.7.5
- Maven 3.6.3
- Java 17
- PostgreSQL
- Postman or Insomnia
Overview
What is jOOQ?
jOOQ (Java Object Oriented Querying) is a popular Java database library that builds type-safe SQL queries through its fluent API. jOOQ includes generators that generate Java code from the database. It also has code generators for Data Access Objects (DAO) and POJOs to effectively complete CRUD operations.
Why jOOQ ?
- Code Generation: jOOQ generates Java classes, JPA-annotated entity classes, interfaces, or even XML from the database metadata.
- Type Safety SQL: jOOQ treats SQL like what it is in the first place: A language. Through its unique and modern fluent API design techniques, jOOQ embeds SQL as an internal domain-specific language directly in Java, making it easy for developers to write and read code that almost feels like actual SQL.
- Database First: With…