jOOQ models SQL as a type-safe Java API with a code generator from database metadata. It targets JDBC-backed relational databases with dialect support and compile-time checks.
Overview
jOOQ is a Java library that embeds SQL as an internal domain-specific language so queries are built and checked through the Java compiler. It generates Java types from your database schema and keeps application code aligned when tables, columns, or routines change.
The main workflow combines a source code generator with a fluent DSL for constructing static and dynamic SQL. Secondary capabilities mentioned in the materials include DAOs, data import and export, type conversion, DDL and DML helpers, diagnostics, and support for many SQL dialects.
Beyond basic querying, jOOQ documents features such as active records for CRUD, multitenancy via schema and table overrides, SQL translation across dialects, hooks into the SQL lifecycle, stored procedures, reactive access via R2DBC, and nested collections through MULTISET and ROW types. Kotlin and Scala integrations are also listed.
The product is positioned around a database-first model: you write SQL-oriented Java rather than letting an ORM own the schema. Generated metadata enables IDE completion for SQL syntax and schema identifiers and catches identifier typos and type mismatches at compile time.
Key features
- Database metadata code generation
- Type-safe SQL DSL API
- Support for many RDBMS dialects
- Dynamic SQL construction
- Active record style CRUD records
- Stored procedure embedding
- SQL parsing and translation
- Schema diff and multitenancy options
Use cases
- Type-safe Java SQL in JDBC applications
- Database-first application development
- Cross-database SQL with dialect transformation
- Complex nested queries with generated types
- CRUD without hand-writing repetitive SQL