jOOQ FAQ

Querying

Q:
jOOQ does not support a vendor-specific function. Can I still use this function?

A:
Yes, whenever something isn't supported out-of-the-box in jOOQ, you can use plain SQL templating to make it work.

Q:
How do I create a constant value in a SQL query?

A:
Constants are just ordinary Field expressions. Use bind values or inline values.

Q:
How do I turn a Field<Boolean> into a Condition?

A:
One can be wrapped by the other, see boolean columns.

Q:
Why am I getting a connection leak?

A:
If you pass jOOQ a JDBC Connection, jOOQ will never close it for you. Instead, try passing jOOQ a DataSource, and jOOQ will manage the connection lifecycle for you.

Q:
How can I change the qualification of tables and columns in jOOQ generated SQL (e.g. for multi tenancy)?

A:
By default, jOOQ fully qualifies all identifiers of tables, columns, and other objects. However, using the runtime schema mapping feature, you can change these qualifications at runtime, configuratively.

Code Generation

Q:
I don't want to connect to a live database for code generation. Can I do it?

A:
Yes, we currently support generating code from XML, JPA entities, and SQL scripts, without requiring a live connection.

Q:
Do I have to use the code generator?

A:
While we recommend using it, you don't have to. You can create queries from identifiers only.

Q:
Where to put generated code?

A:
There is no correct answer to this question, but there are some opinions.

Q:
Why are no classes being generated?

A1:
The <inputSchema/> and many other configuration elements are case sensitive. Please check you're using the right case.

A2:
Your database user needs appropriate privileges to query the dictionary views / information schema.

Q:
I'm getting NoClassDefFoundError or ClassNotFoundException

A:
A very likely reason for this is that you're using different jOOQ versions in your code generator and at runtime. This can happen if you're using third party dependency management, such as Spring Boot, or the third party jOOQ gradle plugin. Make sure you're using the same jOOQ version (and edition!) for everything.

The jOOQ Logo