Available in versions: Dev (3.20) | Latest (3.19) | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11 | 3.10

The jOOQ User Manual

Applies to ✅ Open Source Edition   ✅ Express Edition   ✅ Professional Edition   ✅ Enterprise Edition

Overview

This manual is divided into six main sections:

  • Getting started with jOOQ

    This section will get you started with jOOQ quickly. It contains simple explanations about what jOOQ is, what jOOQ isn't and how to set it up for the first time

  • SQL building

    This section explains all about the jOOQ syntax used for building queries through the query DSL and the query model API. It explains the central factories, the supported SQL statements and various other syntax elements

  • Code generation

    This section explains how to configure and use the built-in source code generator

  • SQL execution

    This section will get you through the specifics of what can be done with jOOQ at runtime, in order to execute queries, perform CRUD operations, import and export data, and hook into the jOOQ execution lifecycle for debugging

  • Tools

    This section is dedicated to tools that ship with jOOQ.

  • Reference

    This section is a reference for elements in this manual

Table of contents

1.
Preface
2.
Copyright, License, and Trademarks
3.
Getting started with jOOQ
3.1.
How to read this manual
3.2.
The sample database used in this manual
3.3.
Different use cases for jOOQ
3.3.1.
jOOQ as a SQL builder without code generation
3.3.2.
jOOQ as a SQL builder with code generation
3.3.3.
jOOQ as a SQL executor
3.3.4.
jOOQ for CRUD
3.3.5.
jOOQ for PROs
3.4.
Getting jOOQ
3.5.
Tutorials
3.5.1.
jOOQ in 7 easy steps
3.5.1.1.
Step 1: Preparation
3.5.1.2.
Step 2: Your database
3.5.1.3.
Step 3: Code generation
3.5.1.4.
Step 4: Connect to your database
3.5.1.5.
Step 5: Querying
3.5.1.6.
Step 6: Iterating
3.5.1.7.
Step 7: Explore!
3.5.2.
Using jOOQ with Flyway
3.5.3.
Using jOOQ with jbang
3.6.
jOOQ and Java 8
3.7.
jOOQ and JavaFX
3.8.
jOOQ and Nashorn
3.9.
jOOQ and Scala
3.10.
jOOQ and Groovy
3.11.
jOOQ and Kotlin
3.12.
jOOQ and NoSQL
3.13.
jOOQ and JPA
3.14.
Build your own
3.15.
jOOQ and backwards-compatibility
4.
SQL building
4.1.
The query DSL type
4.1.1.
DSL subclasses
4.2.
The DSLContext API
4.2.1.
SQL Dialect
4.2.2.
SQL Dialect Family
4.2.3.
SQL Dialect Category
4.2.4.
Connection vs. DataSource
4.2.5.
Custom data
4.2.6.
Custom ExecuteListeners
4.2.7.
Custom Unwrappers
4.2.8.
Custom Settings
4.2.8.1.
Auto-attach Records
4.2.8.2.
Auto-inline bind values
4.2.8.3.
Backslash Escaping
4.2.8.4.
Batch size
4.2.8.5.
Computed column emulation
4.2.8.6.
Diagnostics Connection
4.2.8.7.
Diagnostics Logging
4.2.8.8.
Dollar quoted string token (new)
4.2.8.9.
Execute Logging
4.2.8.10.
Execute Logging SQL Exceptions
4.2.8.11.
Fetch Warnings
4.2.8.12.
GROUP_CONCAT Configuration
4.2.8.13.
Identifier style
4.2.8.14.
Implicit join type
4.2.8.15.
Inline Threshold
4.2.8.16.
IN-list Padding
4.2.8.17.
Interpreter Configuration
4.2.8.18.
JDBC Flags
4.2.8.19.
Keyword style
4.2.8.20.
Listener Invocation Order
4.2.8.21.
Locales
4.2.8.22.
Map JPA Annotations
4.2.8.23.
Object qualification
4.2.8.24.
Object qualification for columns
4.2.8.25.
Optimistic Locking
4.2.8.26.
Parameter name prefix
4.2.8.27.
Parameter types
4.2.8.28.
Parser Configuration
4.2.8.29.
Reflection caching
4.2.8.30.
Return all columns on store
4.2.8.31.
Return computed columns on store
4.2.8.32.
Return DEFAULT columns on store
4.2.8.33.
Return Identity Value On Store
4.2.8.34.
Runtime catalog, schema and table mapping
4.2.8.35.
Scalar subqueries for stored functions
4.2.8.36.
SEEK clause implementation
4.2.8.37.
Statement Type
4.2.8.38.
Updatable Primary Keys
4.2.9.
Thread safety
4.3.
The DSL API
4.3.1.
Mutability (historic)
4.4.
The model API
4.4.1.
Design
4.4.2.
Traversal
4.4.3.
Replacement
4.4.3.1.
Pattern transformation Replacer (new)
4.4.3.2.
Table mapping Replacer (new)
4.4.3.3.
Listening Replacer
4.4.3.4.
Decomposing Replacer
4.4.4.
The historic model API
4.5.
SQL Statements (DML)
4.5.1.
The WITH clause
4.5.2.
The WITH RECURSIVE clause
4.5.3.
The SELECT statement
4.5.3.1.
SELECT clause
4.5.3.1.1.
Projection type safety
4.5.3.1.2.
SelectField
4.5.3.1.3.
Tables as SelectField
4.5.3.1.4.
SELECT *
4.5.3.1.5.
SELECT * EXCEPT (...)
4.5.3.1.6.
SELECT DISTINCT
4.5.3.1.7.
SELECT DISTINCT ON
4.5.3.1.8.
Convenience methods
4.5.3.2.
FROM clause
4.5.3.3.
JOIN operator
4.5.3.4.
Implicit path JOIN
4.5.3.5.
Implicit to-many path JOIN (new)
4.5.3.6.
Explicit path JOIN (new)
4.5.3.7.
Implicit path correlation (new)
4.5.3.8.
WHERE clause
4.5.3.9.
CONNECT BY clause
4.5.3.10.
GROUP BY clause
4.5.3.10.1.
GROUP BY columns
4.5.3.10.2.
GROUP BY column index
4.5.3.10.3.
GROUP BY tables
4.5.3.10.4.
GROUP BY ROLLUP
4.5.3.10.5.
GROUP BY CUBE
4.5.3.10.6.
GROUP BY GROUPING SETS
4.5.3.10.7.
GROUP BY empty grouping set
4.5.3.11.
HAVING clause
4.5.3.12.
WINDOW clause
4.5.3.13.
QUALIFY clause
4.5.3.14.
ORDER BY clause
4.5.3.15.
LIMIT .. OFFSET clause
4.5.3.16.
WITH TIES clause
4.5.3.17.
SEEK clause
4.5.3.18.
FOR clause
4.5.3.19.
FOR UPDATE clause
4.5.3.20.
Set operations
4.5.3.20.1.
Type safety
4.5.3.20.2.
Projection rowtype
4.5.3.20.3.
Differences to standard SQL
4.5.3.20.4.
UNION
4.5.3.20.5.
INTERSECT
4.5.3.20.6.
EXCEPT
4.5.3.21.
Lexical and logical SELECT clause order
4.5.4.
The INSERT statement
4.5.4.1.
INSERT .. VALUES
4.5.4.2.
INSERT .. DEFAULT VALUES
4.5.4.3.
INSERT .. SET
4.5.4.4.
INSERT .. SELECT
4.5.4.5.
INSERT .. ON DUPLICATE KEY UPDATE
4.5.4.6.
INSERT .. ON DUPLICATE KEY UPDATE .. EXCLUDED
4.5.4.7.
INSERT .. ON DUPLICATE KEY IGNORE
4.5.4.8.
INSERT .. ON CONFLICT .. EXCLUDED
4.5.4.9.
INSERT .. ON CONFLICT
4.5.4.10.
INSERT .. RETURNING
4.5.5.
The UPDATE statement
4.5.5.1.
UPDATE .. SET
4.5.5.2.
UPDATE .. SET ROWS
4.5.5.3.
UPDATE .. FROM
4.5.5.4.
UPDATE .. WHERE
4.5.5.5.
UPDATE .. ORDER BY .. LIMIT
4.5.5.6.
UPDATE .. RETURNING
4.5.6.
The DELETE statement
4.5.6.1.
DELETE .. USING
4.5.6.2.
DELETE .. WHERE
4.5.6.3.
DELETE .. ORDER BY .. LIMIT
4.5.6.4.
DELETE .. RETURNING
4.5.7.
The MERGE statement
4.6.
SQL Statements (DDL)
4.6.1.
The ALTER statement
4.6.1.1.
ALTER DATABASE
4.6.1.2.
ALTER DOMAIN
4.6.1.3.
ALTER INDEX
4.6.1.4.
ALTER SCHEMA
4.6.1.5.
ALTER SEQUENCE
4.6.1.6.
ALTER TABLE
4.6.1.7.
ALTER TYPE
4.6.1.7.1.
ALTER TYPE .. RENAME
4.6.1.7.2.
ALTER TYPE .. for enum alterations
4.6.1.8.
ALTER VIEW
4.6.1.8.1.
ALTER VIEW .. AS
4.6.1.8.2.
ALTER VIEW .. COMMENT
4.6.1.8.3.
ALTER VIEW .. RENAME
4.6.1.8.4.
ALTER VIEW IF EXISTS
4.6.2.
The COMMENT statement
4.6.2.1.
COMMENT ON TABLE
4.6.2.2.
COMMENT ON VIEW
4.6.2.3.
COMMENT ON MATERIALIZED VIEW (new)
4.6.2.4.
COMMENT ON COLUMN
4.6.3.
The CREATE statement
4.6.3.1.
CREATE DATABASE
4.6.3.2.
CREATE DOMAIN
4.6.3.3.
CREATE FUNCTION
4.6.3.3.1.
Scalar functions
4.6.3.3.2.
CREATE OR REPLACE FUNCTION
4.6.3.3.3.
SQL data access characteristics
4.6.3.3.4.
DETERMINISTIC characteristic
4.6.3.3.5.
ON NULL INPUT characteristic
4.6.3.4.
CREATE INDEX
4.6.3.5.
CREATE PROCEDURE
4.6.3.5.1.
CREATE OR REPLACE PROCEDURE
4.6.3.5.2.
SQL data access characteristics
4.6.3.6.
CREATE SCHEMA
4.6.3.7.
CREATE SEQUENCE
4.6.3.7.1.
CREATE SEQUENCE IF NOT EXISTS
4.6.3.7.2.
CREATE SEQUENCE .. CACHE
4.6.3.7.3.
CREATE SEQUENCE .. CYCLE
4.6.3.7.4.
CREATE SEQUENCE .. MINVALUE
4.6.3.7.5.
CREATE SEQUENCE .. MAXVALUE
4.6.3.7.6.
CREATE SEQUENCE .. INCREMENT BY
4.6.3.7.7.
CREATE SEQUENCE .. START WITH
4.6.3.8.
CREATE TABLE
4.6.3.8.1.
Columns
4.6.3.8.2.
Nullability
4.6.3.8.3.
Defaults
4.6.3.8.4.
Identities
4.6.3.8.5.
Computed columns
4.6.3.8.6.
Primary key
4.6.3.8.7.
Unique constraints
4.6.3.8.8.
Foreign keys
4.6.3.8.9.
Check constraints
4.6.3.8.10.
From a SELECT
4.6.3.8.11.
Temporary tables
4.6.3.9.
CREATE TRIGGER
4.6.3.9.1.
Events
4.6.3.9.2.
REFERENCING clause
4.6.3.9.3.
STATEMENT vs ROW triggers
4.6.3.9.4.
WHEN clause
4.6.3.10.
CREATE TYPE .. AS ENUM
4.6.3.11.
CREATE TYPE .. AS OBJECT (new)
4.6.3.12.
CREATE VIEW
4.6.3.12.1.
OR REPLACE
4.6.3.12.2.
WITH CHECK OPTION
4.6.3.12.3.
WITH READ ONLY
4.6.3.12.4.
MATERIALIZED (new)
4.6.4.
The DROP statement
4.6.4.1.
DROP DATABASE
4.6.4.1.1.
DROP DATABASE IF EXISTS
4.6.4.2.
DROP DOMAIN
4.6.4.2.1.
DROP DOMAIN IF EXISTS
4.6.4.3.
DROP FUNCTION
4.6.4.3.1.
DROP FUNCTION IF EXISTS
4.6.4.4.
DROP INDEX
4.6.4.4.1.
DROP INDEX IF EXISTS
4.6.4.5.
DROP PROCEDURE
4.6.4.5.1.
DROP PROCEDURE IF EXISTS
4.6.4.6.
DROP SCHEMA
4.6.4.6.1.
DROP SCHEMA IF EXISTS
4.6.4.7.
DROP SEQUENCE
4.6.4.7.1.
DROP SEQUENCE IF EXISTS
4.6.4.8.
DROP TABLE
4.6.4.8.1.
DROP TABLE IF EXISTS
4.6.4.9.
DROP TRIGGER
4.6.4.9.1.
DROP TRIGGER IF EXISTS
4.6.4.10.
DROP TYPE
4.6.4.10.1.
DROP TYPE IF EXISTS
4.6.4.11.
DROP VIEW
4.6.4.11.1.
DROP VIEW IF EXISTS
4.6.4.11.2.
DROP MATERIALIZED VIEW (new)
4.6.5.
The GRANT statement
4.6.6.
The REVOKE statement
4.6.7.
The SET statement
4.6.7.1.
SET CATALOG
4.6.7.2.
SET SCHEMA
4.6.8.
The TRUNCATE statement
4.6.9.
Generating DDL from objects
4.7.
Transactional statements
4.7.1.
START TRANSACTION statement
4.7.2.
COMMIT statement
4.7.3.
ROLLBACK statement
4.7.4.
SAVEPOINT statement
4.7.5.
RELEASE SAVEPOINT statement
4.8.
Procedural statements
4.8.1.
Block statement
4.8.2.
CALL statement
4.8.3.
CONTINUE statement
4.8.4.
EXECUTE statement
4.8.5.
EXIT statement
4.8.6.
FOR statement
4.8.7.
GOTO statement
4.8.8.
IF statement
4.8.9.
Labels
4.8.10.
LOOP statement
4.8.11.
REPEAT statement
4.8.12.
SIGNAL
4.8.13.
Variables
4.8.14.
WHILE statement
4.9.
Catalog and schema expressions
4.10.
Table expressions
4.10.1.
Generated Tables
4.10.2.
Aliased Tables
4.10.2.1.
Aliased generated tables
4.10.2.2.
Aliased table expressions
4.10.2.3.
Aliased joined tables
4.10.2.4.
Derived column lists
4.10.2.5.
Unnamed derived tables
4.10.3.
Joined tables
4.10.3.1.
CROSS JOIN
4.10.3.2.
INNER JOIN
4.10.3.3.
OUTER JOIN
4.10.3.4.
SEMI JOIN
4.10.3.5.
ANTI JOIN
4.10.3.6.
ON clause
4.10.3.7.
ON KEY clause
4.10.3.8.
USING clause
4.10.3.9.
NATURAL clause
4.10.3.10.
LATERAL
4.10.3.11.
APPLY
4.10.3.12.
PARTITION BY
4.10.3.13.
JOIN hints (new)
4.10.3.13.1.
HASH JOIN (new)
4.10.3.13.2.
LOOP JOIN (new)
4.10.3.13.3.
MERGE JOIN (new)
4.10.4.
The VALUES() table constructor
4.10.5.
Derived tables
4.10.6.
Inline derived tables
4.10.7.
The Oracle 11g PIVOT clause
4.10.8.
jOOQ's relational division syntax
4.10.9.
Array and cursor unnesting
4.10.10.
Table-valued functions
4.10.11.
GENERATE_SERIES
4.10.12.
WITH ORDINALITY
4.10.13.
JSON_TABLE
4.10.14.
XMLTABLE
4.10.15.
The DUAL table
4.10.16.
Temporal tables
4.10.17.
Data change delta tables
4.11.
Column expressions
4.11.1.
Table columns
4.11.1.1.
Generated table columns
4.11.1.2.
Dereferenced table columns
4.11.1.3.
Named table columns
4.11.2.
Aliased columns
4.11.3.
Cast expressions
4.11.4.
Cast expressions (with TRY_CAST) (new)
4.11.5.
Datatype coercions
4.11.6.
Readonly columns
4.11.7.
Computed columns
4.11.8.
Collations
4.11.9.
Arithmetic expressions
4.11.10.
String concatenation
4.11.11.
Case sensitivity with strings
4.11.12.
General functions
4.11.12.1.
CHOOSE
4.11.12.2.
COALESCE
4.11.12.3.
DECODE
4.11.12.4.
IIF
4.11.12.5.
NULLIF
4.11.12.6.
NVL
4.11.12.7.
NVL2
4.11.13.
Numeric functions
4.11.13.1.
ABS
4.11.13.2.
ACOS
4.11.13.3.
ASIN
4.11.13.4.
ATAN
4.11.13.5.
ATAN2
4.11.13.6.
CEIL
4.11.13.7.
COS
4.11.13.8.
COSH
4.11.13.9.
COT
4.11.13.10.
COTH
4.11.13.11.
DEG
4.11.13.12.
E
4.11.13.13.
EXP
4.11.13.14.
FLOOR
4.11.13.15.
GREATEST
4.11.13.16.
LEAST
4.11.13.17.
LN
4.11.13.18.
LOG
4.11.13.19.
LOG10
4.11.13.20.
NEG
4.11.13.21.
PI
4.11.13.22.
POWER
4.11.13.23.
RAD
4.11.13.24.
RAND
4.11.13.25.
ROUND
4.11.13.26.
SIGN
4.11.13.27.
SIN
4.11.13.28.
SINH
4.11.13.29.
SQRT
4.11.13.30.
SQUARE
4.11.13.31.
TAN
4.11.13.32.
TANH
4.11.13.33.
TRUNC
4.11.13.34.
WIDTH_BUCKET
4.11.14.
Bitwise functions
4.11.14.1.
BIT_AND
4.11.14.2.
BIT_COUNT
4.11.14.3.
BIT_GET
4.11.14.4.
BIT_NAND
4.11.14.5.
BIT_NOR
4.11.14.6.
BIT_NOT
4.11.14.7.
BIT_OR
4.11.14.8.
BIT_SET
4.11.14.9.
BIT_XNOR
4.11.14.10.
BIT_XOR
4.11.14.11.
SHL
4.11.14.12.
SHR
4.11.15.
String functions
4.11.15.1.
ASCII
4.11.15.2.
BIT_LENGTH
4.11.15.3.
CHR
4.11.15.4.
CONCAT (|| operator)
4.11.15.5.
DIGITS
4.11.15.6.
LEFT
4.11.15.7.
LENGTH
4.11.15.8.
LOWER
4.11.15.9.
LPAD
4.11.15.10.
LTRIM
4.11.15.11.
MD5
4.11.15.12.
MID
4.11.15.13.
OCTET_LENGTH
4.11.15.14.
OVERLAY
4.11.15.15.
POSITION
4.11.15.16.
REGEXP_REPLACE
4.11.15.17.
REPEAT
4.11.15.18.
REPLACE
4.11.15.19.
REVERSE
4.11.15.20.
RIGHT
4.11.15.21.
RPAD
4.11.15.22.
RTRIM
4.11.15.23.
SPACE
4.11.15.24.
SPLIT_PART
4.11.15.25.
SUBSTRING
4.11.15.26.
SUBSTRING_INDEX
4.11.15.27.
TO_CHAR
4.11.15.28.
TO_HEX
4.11.15.29.
TRANSLATE
4.11.15.30.
TRIM
4.11.15.31.
UPPER
4.11.15.32.
UUID
4.11.16.
Datetime functions
4.11.16.1.
CENTURY
4.11.16.2.
CURRENT_DATE
4.11.16.3.
CURRENT_LOCALDATE
4.11.16.4.
CURRENT_LOCALDATETIME
4.11.16.5.
CURRENT_LOCALTIME
4.11.16.6.
CURRENT_OFFSETDATETIME
4.11.16.7.
CURRENT_OFFSETTIME
4.11.16.8.
CURRENT_TIME
4.11.16.9.
CURRENT_TIMESTAMP
4.11.16.10.
DATE
4.11.16.11.
DATEADD
4.11.16.12.
DATEDIFF
4.11.16.13.
DATESUB
4.11.16.14.
DAY
4.11.16.15.
DAY_OF_YEAR
4.11.16.16.
DECADE
4.11.16.17.
EPOCH
4.11.16.18.
EXTRACT
4.11.16.19.
HOUR
4.11.16.20.
ISO_DAY_OF_WEEK
4.11.16.21.
LOCALDATE
4.11.16.22.
LOCALDATEADD
4.11.16.23.
LOCALDATESUB
4.11.16.24.
LOCALDATETIME
4.11.16.25.
LOCALDATETIMEADD
4.11.16.26.
LOCALDATETIMESUB
4.11.16.27.
LOCALTIME
4.11.16.28.
MILLENNIUM
4.11.16.29.
MINUTE
4.11.16.30.
MONTH
4.11.16.31.
QUARTER
4.11.16.32.
SECOND
4.11.16.33.
TIME
4.11.16.34.
TIMESTAMP
4.11.16.35.
TIMESTAMPADD
4.11.16.36.
TIMESTAMPSUB
4.11.16.37.
TO_DATE
4.11.16.38.
TO_LOCALDATE
4.11.16.39.
TO_LOCALDATETIME
4.11.16.40.
TO_TIMESTAMP
4.11.16.41.
TRUNC
4.11.16.42.
YEAR
4.11.17.
ARRAY functions
4.11.17.1.
ARRAY_APPEND (|| operator)
4.11.17.2.
ARRAY_CONCAT (|| operator)
4.11.17.3.
ARRAY_GET
4.11.17.4.
ARRAY_OVERLAP
4.11.17.5.
ARRAY_PREPEND (|| operator)
4.11.17.6.
ARRAY_REMOVE
4.11.17.7.
ARRAY_REPLACE
4.11.17.8.
ARRAY constructor
4.11.17.9.
ARRAY constructor from subquery
4.11.17.10.
CARDINALITY
4.11.18.
JSON functions
4.11.18.1.
JSON_ARRAY
4.11.18.2.
JSON_INSERT function
4.11.18.3.
JSON_KEYS
4.11.18.4.
JSON_OBJECT
4.11.18.5.
JSON_REMOVE function
4.11.18.6.
JSON_REPLACE function
4.11.18.7.
JSON_SET function
4.11.18.8.
JSON_VALUE
4.11.18.9.
JSON array element access with -> or ->>
4.11.18.10.
JSON object attribute access with -> or ->>
4.11.19.
XML functions
4.11.19.1.
XMLATTRIBUTES
4.11.19.2.
XMLCOMMENT
4.11.19.3.
XMLCONCAT
4.11.19.4.
XMLDOCUMENT
4.11.19.5.
XMLELEMENT
4.11.19.6.
XMLFOREST
4.11.19.7.
XMLPARSE
4.11.19.8.
XMLPI
4.11.19.9.
XMLQUERY
4.11.19.10.
XMLSERIALIZE
4.11.20.
System functions
4.11.20.1.
CURRENT_SCHEMA
4.11.20.2.
CURRENT_USER
4.11.21.
Spatial functions
4.11.21.1.
ST_Area
4.11.21.2.
ST_AsText
4.11.21.3.
ST_Centroid
4.11.21.4.
ST_Difference
4.11.21.5.
ST_Distance
4.11.21.6.
ST_EndPoint
4.11.21.7.
ST_ExteriorRing
4.11.21.8.
ST_GeometryN
4.11.21.9.
ST_GeometryType
4.11.21.10.
ST_GeomFromText
4.11.21.11.
ST_InteriorRingN
4.11.21.12.
ST_Intersection
4.11.21.13.
ST_Length
4.11.21.14.
ST_NumGeometries
4.11.21.15.
ST_NumInteriorRings
4.11.21.16.
ST_NumPoints
4.11.21.17.
ST_PointN
4.11.21.18.
ST_SRID
4.11.21.19.
ST_StartPoint
4.11.21.20.
ST_Union
4.11.21.21.
ST_X
4.11.21.22.
ST_Y
4.11.21.23.
ST_Z
4.11.22.
Aggregate functions
4.11.22.1.
Grouping
4.11.22.2.
Distinctness
4.11.22.3.
Filtering
4.11.22.4.
Ordering
4.11.22.5.
Ordering WITHIN GROUP
4.11.22.6.
Keeping
4.11.22.7.
ANY_VALUE
4.11.22.8.
ARRAY_AGG
4.11.22.9.
AVG
4.11.22.10.
BIT_AND_AGG
4.11.22.11.
BIT_NAND_AGG
4.11.22.12.
BIT_NOR_AGG
4.11.22.13.
BIT_OR_AGG
4.11.22.14.
BIT_XOR_AGG
4.11.22.15.
BIT_XNOR_AGG
4.11.22.16.
BOOL_AND
4.11.22.17.
BOOL_OR
4.11.22.18.
COLLECT
4.11.22.19.
COUNT
4.11.22.20.
CUME_DIST
4.11.22.21.
DENSE_RANK
4.11.22.22.
EVERY
4.11.22.23.
GROUP_CONCAT
4.11.22.24.
JSON_ARRAYAGG
4.11.22.25.
JSON_OBJECTAGG
4.11.22.26.
LISTAGG
4.11.22.27.
MAX
4.11.22.28.
MEDIAN
4.11.22.29.
MIN
4.11.22.30.
MODE
4.11.22.31.
MULTISET_AGG
4.11.22.32.
PERCENT_RANK
4.11.22.33.
PERCENTILE_CONT
4.11.22.34.
PERCENTILE_DISC
4.11.22.35.
PRODUCT
4.11.22.36.
RANK
4.11.22.37.
SUM
4.11.22.38.
XMLAGG
4.11.23.
Window functions
4.11.23.1.
PARTITION BY
4.11.23.2.
ORDER BY
4.11.23.3.
ROWS, RANGE, GROUPS (frame clause)
4.11.23.4.
EXCLUDE
4.11.23.5.
NULL treatment
4.11.23.6.
FROM FIRST, FROM LAST
4.11.23.7.
Nested aggregate functions
4.11.23.8.
Window aggregation
4.11.23.9.
Window ordered aggregate
4.11.23.10.
ROW_NUMBER
4.11.23.11.
RANK
4.11.23.12.
DENSE_RANK
4.11.23.13.
PERCENT_RANK
4.11.23.14.
CUME_DIST
4.11.23.15.
NTILE
4.11.23.16.
LEAD
4.11.23.17.
LAG
4.11.23.18.
FIRST_VALUE
4.11.23.19.
LAST_VALUE
4.11.23.20.
NTH_VALUE
4.11.24.
Grouping functions
4.11.25.
User-defined functions
4.11.26.
User-defined aggregate functions
4.11.27.
User-defined type attribute paths (new)
4.11.28.
The CASE expression
4.11.29.
Sequences and serials
4.11.30.
Scalar subqueries
4.11.31.
ARRAY value constructor
4.11.32.
MULTISET value constructor
4.11.33.
Tuples or row value expressions
4.11.34.
Nested records
4.12.
Conditional expressions
4.12.1.
Condition building
4.12.2.
TRUE and FALSE condition
4.12.3.
BOOLEAN columns
4.12.4.
AND, OR, NOT boolean operators
4.12.5.
XOR
4.12.6.
Comparison predicate
4.12.7.
Boolean operator precedence
4.12.8.
Comparison predicate (degree > 1)
4.12.9.
Quantified comparison predicate
4.12.10.
BETWEEN predicate
4.12.11.
BETWEEN predicate (degree > 1)
4.12.12.
DISTINCT predicate
4.12.13.
DOCUMENT predicate
4.12.14.
EXISTS predicate
4.12.15.
IN predicate
4.12.16.
IN predicate (degree > 1)
4.12.17.
JSON predicate
4.12.18.
JSON_EXISTS predicate
4.12.19.
LIKE predicate
4.12.20.
NULL predicate
4.12.21.
NULL predicate (degree > 1)
4.12.22.
OVERLAPS predicate
4.12.23.
SIMILAR TO predicate
4.12.24.
Spatial predicates
4.12.24.1.
ST_Contains
4.12.24.2.
ST_Crosses
4.12.24.3.
ST_Disjoint
4.12.24.4.
ST_Equals
4.12.24.5.
ST_Intersects
4.12.24.6.
ST_IsClosed
4.12.24.7.
ST_IsEmpty
4.12.24.8.
ST_Overlaps
4.12.24.9.
ST_Touches
4.12.24.10.
ST_Within
4.12.25.
UNIQUE predicate
4.12.26.
XMLEXISTS predicate
4.12.27.
Query By Example (QBE)
4.13.
Operator precedence
4.14.
Synthetic SQL clauses
4.15.
Dynamic SQL
4.15.1.
Optional column expressions
4.15.2.
Optional conditional expressions
4.15.3.
Optional conditional tables (new)
4.16.
Plain SQL
4.17.
Plain SQL Templating Language
4.18.
Plain SQL raw templates
4.19.
Hints
4.19.1.
MySQL hints
4.19.1.1.
Index hints
4.19.1.2.
STRAIGHT_JOIN
4.19.1.3.
Oracle style hints in MySQL
4.19.2.
Oracle hints
4.19.3.
SQL Server hints
4.19.3.1.
WITH
4.19.3.2.
OPTION
4.20.
SQL Parser
4.20.1.
SQL Parser API
4.20.2.
SQL Parser CLI
4.20.3.
SQL Parser Listener
4.20.4.
SQL translator
4.20.5.
SQL Parser Grammar
4.21.
SQL interpreter
4.22.
Schema diff
4.23.
Schema diff CLI
4.24.
Names and identifiers
4.25.
Bind values and parameters
4.25.1.
Indexed parameters
4.25.2.
Named parameters
4.25.3.
Inlined parameters
4.25.4.
SQL injection
4.26.
QueryParts
4.26.1.
SQL rendering
4.26.2.
Declaration vs reference
4.26.3.
Pretty printing SQL
4.26.4.
Variable binding
4.26.5.
Custom data type bindings
4.26.6.
Custom syntax elements
4.26.7.
Plain SQL QueryParts
4.26.8.
Serializability
4.26.9.
SQL transformation
4.26.9.1.
ANSI JOIN to table lists
4.26.9.2.
Table lists to ANSI JOIN
4.26.9.3.
ROWNUM to LIMIT
4.26.9.4.
QUALIFY to derived table
4.26.9.5.
IN condition subquery with LIMIT to derived table
4.26.9.6.
GROUP BY <column index>
4.26.9.7.
Inline CTE
4.26.9.8.
Unnecessary arithmetic expressions
4.26.9.9.
Pattern based transformation
4.26.9.9.1.
AND to NOT IN
4.26.9.9.2.
Arithmetic comparisons
4.26.9.9.3.
Arithmetic expressions
4.26.9.9.4.
BIT_GET function
4.26.9.9.5.
BIT_SET function
4.26.9.9.6.
CASE searched to CASE simple
4.26.9.9.7.
CASE to CASE abbreviation
4.26.9.9.8.
CASE with DISTINCT FROM to DECODE
4.26.9.9.9.
CASE with ELSE NULL
4.26.9.9.10.
COUNT(*) scalar subquery comparison
4.26.9.9.11.
COUNT(const)
4.26.9.9.12.
COUNT(expr) scalar subquery comparison
4.26.9.9.13.
DISTINCT FROM NULL
4.26.9.9.14.
Empty scalar subquery
4.26.9.9.15.
Flatten CASE
4.26.9.9.16.
Flatten CASE abbreviations
4.26.9.9.17.
Flatten DECODE
4.26.9.9.18.
Hyperbolic functions
4.26.9.9.19.
Idempotent function repetition
4.26.9.9.20.
Inverse hyperbolic functions
4.26.9.9.21.
Logarithmic functions
4.26.9.9.22.
Merge AND predicates
4.26.9.9.23.
Merge BIT_NOT with BIT_NAND
4.26.9.9.24.
Merge BIT_NOT with BIT_NOR
4.26.9.9.25.
Merge BIT_NOT with BIT_XNOR
4.26.9.9.26.
Merge CASE .. WHEN and ELSE clauses
4.26.9.9.27.
Merge CASE .. WHEN clauses
4.26.9.9.28.
Merge IN predicates
4.26.9.9.29.
Merge NOT with comparison predicates
4.26.9.9.30.
Merge NOT with DISTINCT predicate
4.26.9.9.31.
Merge OR predicates
4.26.9.9.32.
Merge range predicates
4.26.9.9.33.
Normalise associative operations
4.26.9.9.34.
Normalise fields compared to values
4.26.9.9.35.
Normalise IN list with single element to comparison
4.26.9.9.36.
NOT AND
4.26.9.9.37.
NOT OR
4.26.9.9.38.
NULL ON NULL INPUT
4.26.9.9.39.
OR to IN
4.26.9.9.40.
Repeated bitwise negation
4.26.9.9.41.
Repeated logical negation
4.26.9.9.42.
Repeated NOT
4.26.9.9.43.
Simplify CASE abbreviations
4.26.9.9.44.
Trigonometric functions
4.26.9.9.45.
Trim
4.26.9.9.46.
Trivial bitwise operations
4.26.9.9.47.
Trivial CASE abbreviations
4.26.9.9.48.
Trivial predicates
4.26.9.9.49.
Unnecessary DISTINCT
4.26.9.9.50.
Unnecessary EXISTS subquery clauses
4.26.9.9.51.
Unnecessary GROUP BY expressions
4.26.9.9.52.
Unnecessary INNER JOIN
4.26.9.9.53.
Unnecessary ORDER BY expressions
4.26.9.9.54.
Unnecessary scalar subquery
4.26.9.9.55.
Unreachable CASE clauses
4.26.9.9.56.
Unreachable DECODE clauses
4.26.10.
Custom SQL transformation with VisitListener
4.26.10.1.
Example: Logging abbreviated bind values
4.26.11.
Policies (new)
4.26.11.1.
Configuration (new)
4.26.11.2.
Implementation (new)
4.26.11.3.
Inheritance (new)
4.26.11.4.
Security considerations (new)
4.27.
Zero-based vs one-based APIs
4.28.
SQL building in Kotlin
4.28.1.
Kotlin MULTISET Collectors
4.28.2.
Kotlin ResultQuery Collectors
4.28.3.
Kotlin BOOLEAN value expressions
4.28.4.
Kotlin ARRAY access
4.28.5.
Kotlin JSON access
4.28.6.
Kotlin coroutine support
4.29.
SQL building in Scala
5.
SQL execution
5.1.
Comparison between jOOQ and JDBC
5.2.
Query vs. ResultQuery
5.3.
Fetching
5.3.1.
Record vs. TableRecord
5.3.2.
Record1 to Record22
5.3.3.
Arrays, Maps and Lists
5.3.4.
RecordHandler
5.3.5.
RecordMapper
5.3.6.
POJOs
5.3.7.
The RecordMapperProvider SPI
5.3.8.
Ad-hoc Converter
5.3.9.
ConverterProvider
5.3.10.
Lazy fetching
5.3.11.
Lazy fetching with Streams
5.3.12.
Many fetching
5.3.13.
Later fetching
5.3.14.
Reactive Fetching
5.3.15.
ResultSet fetching
5.3.16.
Auto data type conversion
5.3.17.
Custom data type conversion
5.3.18.
Context Converter
5.4.
Static statements vs. Prepared Statements
5.5.
Reusing a Query's PreparedStatement
5.6.
JDBC flags
5.7.
Using JDBC batch operations
5.8.
Sequence execution
5.9.
Stored procedures and functions
5.9.1.
Oracle Packages
5.9.2.
Oracle member procedures
5.10.
Exporting to XML, CSV, JSON, HTML, Text, Charts
5.10.1.
Exporting XML
5.10.2.
Exporting CSV
5.10.3.
Exporting JSON
5.10.4.
Exporting HTML
5.10.5.
Exporting Text
5.10.6.
Exporting Charts
5.10.7.
FormattingProvider
5.11.
Importing data
5.11.1.
The Loader API
5.11.2.
Import options
5.11.2.1.
Throttling
5.11.2.2.
Duplicate handling
5.11.2.3.
Error handling
5.11.3.
Import data sources
5.11.3.1.
Importing CSV
5.11.3.2.
Importing JSON
5.11.3.3.
Importing records
5.11.3.4.
Importing arrays
5.11.3.5.
Importing XML
5.11.4.
Import listeners
5.11.5.
Import result and error handling
5.12.
CRUD with UpdatableRecords
5.12.1.
Simple CRUD
5.12.2.
Records' internal flags
5.12.3.
IDENTITY values
5.12.4.
Navigation methods
5.12.5.
Non-updatable records
5.12.6.
Optimistic locking
5.12.7.
Batch execution
5.12.8.
CRUD SPI: RecordListener
5.13.
DAOs
5.14.
Transaction management
5.15.
Exception handling
5.16.
ExecuteListeners
5.17.
Database meta data
5.17.1.
JDBC meta data
5.17.2.
Interpreted meta data
5.17.3.
XML meta data
5.17.4.
Generated meta data
5.18.
JDBC Connection
5.19.
Batched Connection
5.20.
Mocking Connection
5.21.
Mock File Database
5.22.
Parsing Connection
5.23.
Diagnostics
5.23.1.
Too Many Rows
5.23.2.
Too Many Columns
5.23.3.
Duplicate Statements
5.23.4.
Repeated statements
5.23.5.
Consecutive aggregation
5.23.6.
WasNull calls
5.23.7.
Concatenation in predicates
5.23.8.
Possibly wrong expressions
5.23.9.
Trivial condition
5.23.10.
Transform patterns
5.24.
Logging with LoggerListener
5.25.
Logging with SQLExceptionLoggerListener
5.26.
Logging Connection
5.27.
Logging system properties (new)
5.28.
Performance considerations
5.29.
Alternative execution models
5.29.1.
Using jOOQ with Spring's JdbcTemplate
5.29.2.
Using jOOQ with JPA
5.29.2.1.
Using jOOQ with JPA Native Query
5.29.2.2.
Using jOOQ with JPA entities
5.29.2.3.
Using jOOQ with JPA EntityResult
6.
Code generation
6.1.
Configuration and setup of the generator
6.2.
Advanced generator configuration
6.2.1.
Logging
6.2.2.
Error handling
6.2.3.
Jdbc
6.2.4.
Generator
6.2.5.
Database
6.2.5.1.
Database name and properties
6.2.5.2.
Inline database implementation (new)
6.2.5.3.
RegexFlags
6.2.5.4.
Includes and Excludes
6.2.5.5.
Include object types
6.2.5.6.
Record Version and Timestamp Fields
6.2.5.7.
Comments
6.2.5.8.
Synthetic objects
6.2.5.8.1.
Synthetic columns
6.2.5.8.2.
Synthetic readonly columns
6.2.5.8.3.
Synthetic readonly ROWIDs
6.2.5.8.4.
Synthetic identities
6.2.5.8.5.
Synthetic enums (new)
6.2.5.8.6.
Synthetic primary keys
6.2.5.8.7.
Synthetic unique keys
6.2.5.8.8.
Synthetic foreign keys
6.2.5.9.
Date as timestamp
6.2.5.10.
Ignore procedure return values (deprecated)
6.2.5.11.
Readonly columns
6.2.5.12.
Unsigned types
6.2.5.13.
Catalog and schema mapping
6.2.5.14.
Catalog and schema version providers
6.2.5.15.
Custom ordering of generated code
6.2.5.16.
Forced types
6.2.5.16.1.
Matching of forced types
6.2.5.16.2.
Data type rewriting
6.2.5.16.3.
Qualified converters
6.2.5.16.4.
Inline converters
6.2.5.16.5.
Lambda converters
6.2.5.16.6.
Auto converters
6.2.5.16.7.
Enum converters
6.2.5.16.8.
Jackson converters
6.2.5.16.9.
JAXB converters
6.2.5.16.10.
Data type bindings
6.2.5.16.11.
Client side computed columns
6.2.5.16.12.
Audit columns
6.2.5.16.13.
Visibility Modifier (per forced type)
6.2.5.17.
Table valued functions
6.2.6.
Generate
6.2.6.1.
Annotations
6.2.6.2.
Covariant overrides
6.2.6.2.1.
Overriding as()
6.2.6.2.2.
Overriding rename()
6.2.6.2.3.
Overriding where() (new)
6.2.6.3.
Default catalog and schema
6.2.6.4.
Extended types
6.2.6.5.
Fluent setters
6.2.6.6.
Fully Qualified Types
6.2.6.7.
Global Artefacts
6.2.6.8.
Global object names (new)
6.2.6.9.
Implicit JOIN paths
6.2.6.10.
Java Time Types
6.2.6.11.
Serial Version UID
6.2.6.12.
Sources
6.2.6.13.
Text blocks
6.2.6.14.
Visibility Modifier (global)
6.2.6.15.
Whitespace (newlines and indentation)
6.2.6.16.
Zero Scale Decimal Types
6.2.7.
Output target configuration
6.3.
Programmatic generator configuration
6.4.
Custom generator strategies
6.5.
Matcher strategies
6.5.1.
MatcherRule
6.5.2.
Matching catalogs
6.5.3.
Matching schemas
6.5.4.
Matching tables
6.5.5.
Matching fields
6.5.6.
Matching indexes (new)
6.5.7.
Matching primary keys (new)
6.5.8.
Matching unique keys (new)
6.5.9.
Matching foreign keys (new)
6.5.10.
Matching routines
6.5.11.
Matching sequences
6.5.12.
Matching enums
6.5.13.
Matching embeddables
6.5.14.
Matching UDTs (new)
6.5.15.
Matching attributes (new)
6.5.16.
Matcher examples
6.6.
Custom code sections
6.7.
Generated global artefacts
6.8.
Generated tables
6.9.
Generated records
6.10.
Generated POJOs
6.11.
Generated Interfaces
6.12.
Generated DAOs
6.13.
Generated sequences
6.14.
Generated procedures
6.15.
Generated domains
6.16.
Generated UDTs
6.17.
Data type extensions
6.17.1.
PostgreSQL
6.18.
Embeddable types
6.18.1.
Configuration
6.18.2.
Overlapping embeddable types
6.18.3.
Field replacement
6.18.4.
Embedded keys
6.18.5.
Embedded domains
6.19.
Mapping generated catalogs and schemas
6.20.
Code generation for large schemas
6.21.
Code generation and version control
6.22.
JPADatabase: Code generation from entities
6.23.
XMLDatabase: Code generation from XML files
6.24.
DDLDatabase: Code generation from SQL files
6.25.
LiquibaseDatabase: Code generation from Liquibase XML, YAML, JSON files
6.26.
XMLGenerator: Generating XML
6.27.
KotlinGenerator
6.28.
ScalaGenerator
6.29.
Running the code generator with Maven
6.30.
Running the code generator with Ant
6.31.
Running the code generator with Gradle
6.32.
System properties governing code generation
6.33.
In-memory compilation of programmatic configuration (new)
6.34.
Features requiring generated code
7.
Tools
7.1.
API validation using the Checker Framework or Error Prone
7.2.
jOOQ Refaster
7.3.
jOOQ Console
8.
Coming from JPA
8.1.
Set based thinking
8.2.
Database first
8.3.
Eager or lazy loading
8.4.
First level cache and second level cache
8.5.
Embeddable
8.6.
AttributeConverter
8.7.
User types
8.8.
Implicit JOIN
8.9.
@OneToOne or @ManyToOne
8.10.
@OneToMany or @ManyToMany
9.
Reference
9.1.
Supported RDBMS
9.2.
Commercial only features
9.3.
Experimental features
9.4.
Data types
9.4.1.
BLOBs and CLOBs
9.4.2.
BOOLEAN data type
9.4.3.
Unsigned integer types
9.4.4.
INTERVAL data types
9.4.5.
JSON data types
9.4.6.
XML data types
9.4.7.
Spatial data types
9.4.8.
CURSOR data types
9.4.9.
ARRAY and TABLE data types
9.4.10.
Oracle DATE data type
9.4.11.
Domains
9.5.
SQL to DSL mapping rules
9.6.
Quality Assurance
9.7.
Security
9.7.1.
SQL Injection
9.7.2.
Debug logging
9.7.3.
Exception message
9.7.4.
Contact
9.8.
Migrating to jOOQ 3.0
9.9.
Don't do this
9.9.1.
jOOQ: Implementing the DSL types
9.9.2.
jOOQ: Referencing the Step types
9.9.3.
Schema: NULL columns
9.9.4.
Schema: Unnamed constraints
9.9.5.
Schema: Unnecessary surrogate keys
9.9.6.
Schema: Wrong data types
9.9.7.
SQL: COUNT(*) instead of EXISTS()
9.9.8.
SQL: N+1
9.9.9.
SQL: NOT IN predicate
9.9.10.
SQL: Rely on implicit ordering
9.9.11.
SQL: SELECT *
9.9.12.
SQL: SELECT DISTINCT
9.9.13.
SQL: Unnecessary UNION instead of UNION ALL
9.10.
The most important jOOQ types
9.11.
Credits

next

Feedback

Do you have any feedback about this page? We'd love to hear it!

The jOOQ Logo