Available in versions: Dev (3.18) | Latest (3.17) | 3.16 | 3.15 | 3.14

This documentation is for the unreleased development version of jOOQ. Click on the above version links to get this documentation for a supported version of jOOQ.

Kotlin BOOLEAN value expressions

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

A BOOLEAN column (Field<Boolean>) and a conditional expression (Condition) are not really too different, especially when the dialect supports standard SQL BOOLEAN types.

In jOOQ, the two things can often be used exchangeably, but there are some exceptions, mainly when BOOLEAN operators should be used with (Field<Boolean>):


At least the left side of the expression has to be wrapped with DSL.condition(Field), which is cumbersome.

Using the kotlin extensions module, these operators are also made available on Field<Boolean> directly:

package org.jooq.kotlin

fun Field<Boolean>.and(other: Condition): Condition = condition(this).and(other)
fun Field<Boolean>.or(other: Condition): Condition = condition(this).or(other)
fun Field<Boolean>.not(): Condition = condition(this).not()

// [... and more]

This allows for the leaner version below:



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

The jOOQ Logo