Simplifying ANTI JOIN with jOOQ Syntax

ANTI JOIN is a very useful operator from relational algebra. Regrettably, only few dialects support it in terms of SQL syntax, as we've written earlier. In jOOQ, you can write it as follows: ctx.select(AUTHOR.ID) .from(AUTHOR) .leftAntiJoin(BOOK).on(BOOK.AUTHOR_ID.eq(AUTHOR.ID)) If your RDBMS supports this natively (e.g. ClickHouse, Databricks), then it is rendered as such. Otherwise, jOOQ will translate … Continue reading Simplifying ANTI JOIN with jOOQ Syntax

Managing Sensitive Data in jOOQ 3.21+ Logs

One of jOOQ's most popular feature is the out-of-the-box debug logging experience. jOOQ developers find this feature very useful when developing their applications. Assuming you run a jOOQ query and configure your logger to print DEBUG log output: ctx.select(BOOK.ID, BOOK.TITLE) .from(BOOK) .orderBy(BOOK.ID) .limit(1, 2) .fetch(); When this query is executed, your log output might contain … Continue reading Managing Sensitive Data in jOOQ 3.21+ Logs

Resisting the Urge to Document Everything Everywhere

Every product manager knows this situation: A user works with feature X1. They find a limitation / bug / quirk and want to work around it. The perfect workaround or alternative is feature X2, but without knowing that X2 exists, the user doesn't find it and spends a lot of time looking for it. The … Continue reading Resisting the Urge to Document Everything Everywhere

jOOQ 3.20 released with ClickHouse, Databricks, and much more DuckDB support, new modules, Oracle type hierarchies, more spatial support, decfloat and synonym support, hidden columns, Scala 3, Kotlin 2, and much more

New dialects: jOOQ 3.20 ships with 2 new experimental dialects: ClickHouse in all editions, including the jOOQ Open Source Edition Databricks in the jOOQ Enterprise Edition ClickHouse is a fast-moving SQL dialect with a historic vendor-specific syntax that is gradually migrated to a more standards compliant alternative, which is why our support is still experimental. … Continue reading jOOQ 3.20 released with ClickHouse, Databricks, and much more DuckDB support, new modules, Oracle type hierarchies, more spatial support, decfloat and synonym support, hidden columns, Scala 3, Kotlin 2, and much more

A Hidden Benefit of Implicit Joins: Join Elimination

One of jOOQ's key features so far has always been to render pretty much exactly the SQL that users expect, without any surprises - unless some emulation is required to make a query work, of course. This means that while join elimination is a powerful feature of many RDBMS, it isn't part of jOOQ's feature … Continue reading A Hidden Benefit of Implicit Joins: Join Elimination

jOOQ 3.19’s new Explicit and Implicit to-many path joins

jOOQ 3.19 finally delivers on a set of features that will greatly simplify your queries further, after jOOQ 3.11 introduced implicit to-one joins: Explicit path joins To-many path joins Implicit join path correlation What are these features? Many ORMs (e.g. JPA, Doctrine, jOOQ 3.11 and others) support "path joins" (they may have different names for … Continue reading jOOQ 3.19’s new Explicit and Implicit to-many path joins

To DAO or not to DAO

jOOQ's DAO API is one of jOOQ's most controversial features. When it was first implemented, it was implemented merely: Because it was so easy to implement Because it seemed so useful for simple CRUD tasks Because that's what many developers want There's a strong hint about the third bullet given how popular Spring Data's repository … Continue reading To DAO or not to DAO

How to Generate Package Private Code with jOOQ’s Code Generator

Java's package private visibility is an underrated feature. When you omit any visibility modifier in Java, then the default (for most objects) is package private, i.e. the object is visible only to types in the same package: class YouDontSeeMe {} class YouDontSeeMeEither {} In fact, a compilation unit (the .java file) can contain multiple such … Continue reading How to Generate Package Private Code with jOOQ’s Code Generator

How to Pass a Table Valued Parameter to a T-SQL Function with jOOQ

Microsoft T-SQL supports a language feature called table-valued parameter (TVP), which is a parameter of a table type that can be passed to a stored procedure or function. For example, you may write: CREATE TYPE u_number_table AS TABLE (column_value INTEGER); CREATE FUNCTION f_cross_multiply ( @numbers u_number_table READONLY ) RETURNS @result TABLE ( i1 INTEGER, i2 … Continue reading How to Pass a Table Valued Parameter to a T-SQL Function with jOOQ