~/devreads

#jooq-development

62 posts

28 Feb 2025

lukaseder 1 min read

Every product manager knows this situation: This is such a common pattern, and while it’s perfectly understandable for such a user to request this, it is so terribly wrong to give in to this user’s request. Why is it wrong? The features are unrelated Most of the time, the two features X1 and X2 are … Continue reading Resisting the…

jooq-developmentcaveatdocumentationjooqqa

20 Feb 2025

lukaseder 1 min read

New dialects: jOOQ 3.20 ships with 2 new experimental dialects: 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. A lot of behaviours differ from what one would expect elsewhere, including NULL handling, which is … Continue reading jOOQ 3.20…

jooq-developmentclickhousedatabricksdecfloatdirty tracking

28 Dec 2023

lukaseder 1 min read

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: What are these features? Many ORMs (e.g. JPA, Doctrine, jOOQ 3.11 and others) support “path joins” (they may have different names for this concept). A path join is a join derived from … Continue reading jOOQ 3.19’s…

jooq-developmentcorrelated subqueriesexplicit path joinsimplicit join path correlationimplicit joins

15 Dec 2023

lukaseder 1 min read

New Dialects It’s been a few releases since we’ve added support for new dialects, but finally some very interesting RDBMS of increasing popularity have joined the jOOQ family including: These dialects are available in all jOOQ editions. New dialect versions In addition to these entirely new dialects, big new CockroachDB and Oracle versions have shipped: … Continue reading jOOQ 3.19.0…

jooq-developmentcockroachdb 23duckdbgradlegradle plugin

24 Mar 2023

25 Aug 2022

lukaseder 1 min read

Since jOOQ 3.11, implicit joins have been supported. An implicit join is a JOIN (mostly a LEFT JOIN) that is generated implicitly because of the presence of a path expression. If SQL supported the syntax natively, it would look like this: All that is is convenience for a bunch of explicitly written LEFT JOIN expressions: … Continue reading jOOQ 3.17…

jooq-developmentdeleteimplicit joinjooqupdate

30 Jun 2022

lukaseder 1 min read

One of jOOQ 3.17‘s coolest new features are client side computed columns. jOOQ 3.16 already added support for server side computed columns, which many of you appreciate for various reasons. What’s a computed column? A computed column is a column that is derived (“computed”) from an expression. It cannot be written to. It works like … Continue reading Create Dynamic…

jooq-developmentclient side computed columnscomputed columnsjavajooq

22 Jun 2022

lukaseder 1 min read

This release contiues the work from previous releases around more sophisticated SQL transformation capabilities, including: Client side computed columns for both read and write operations Audit columns Pattern matching SQL transformations More implicit JOIN capabilities Client side computed columns A ground breaking new core feature available in all commercial distributions isthe new client side computed … Continue reading 3.17.0 Release…

jooq-developmentaudit columnsclient side computed columnscomputed columnscoroutines

9 Jun 2022

lukaseder 1 min read

It’s been a while since jOOQ 3.15 has been released with its revolutionary standard SQL MULTISET emulation feature. A thing that has been long overdue and which I promised on twitter a few times is to run a few benchmarks comparing the performance of various approaches to nesting to-many relationships with jOOQ. This article will … Continue reading The Performance…

jooq-developmentjavajooqjson arrayaggmany-to-many

31 May 2022

lukaseder 1 min read

Every now and then, I see folks lament the SQL syntax’s peculiar disconnect between the lexical order of operations (SELECT .. FROM) the logical order of operations (FROM .. SELECT) Most recently here in a Youtube comment reply to a recent jOOQ/kotlin talk. Let’s look at why jOOQ didn’t fall into this trap of trying … Continue reading Changing SELECT…

jooq-developmentjooqorder of operationssqlsql syntax

11 May 2022

lukaseder 1 min read

An interesting hint by Vladimir Sitnikov has made me think about a new benchmark for jOOQ: The benchmark should check whether single row queries should have a JDBC Statement.setFetchSize(1) call made to them by default. The Javadoc of the method says: Gives the JDBC driver a hint as to the number of rows that should … Continue reading Setting the…

jooq-developmentsqldb2fetch sizefetchsize

28 Apr 2022

lukaseder 1 min read

Since jOOQ 3.4, we have an API that simplifies transactional logic on top of JDBC in jOOQ, and starting from jOOQ 3.17 and #13502, an equivalent API will also be made available on top of R2DBC, for reactive applications. As with everything jOOQ, transactions are implemented using explicit, API based logic. The implicit logic implemented … Continue reading Nested Transactions…

jooq-developmentjakarta eejavajdbcjooq

21 Feb 2022

lukaseder 1 min read

A long standing feature request has seen little love from the jOOQ community, despite a lot of people probably wanting it. It goes by the unimpressive title Let Table<R> extend SelectField<R>: https://github.com/jOOQ/jOOQ/issues/4727 What does the feature mean, specifically? The awesome PostgreSQL Let’s have a look at a really cool PostgreSQL feature. In PostgreSQL, it is … Continue reading Projecting Type…

jooq-developmentsqlad-hoc converterimplicit joinsjooq

14 Feb 2022

lukaseder 1 min read

A tidal wave is rippling through the Java ecosystem. It is the renaming of javax to jakarta package names. Now, while we’ve all been whining and complaining and shaking our heads due the clash between corporate legal and engineering interests, eventually it’s time to move on and learn what this means specifically, for jOOQ. jOOQ … Continue reading jOOQ 3.16…

jooq-developmentbean validationdependenciesjakarta eejava ee

2 Feb 2022

lukaseder 1 min read

Starting from jOOQ 3.16, we’re investing a lot into opening up our internal query object model (QOM) as a public API. This is mainly useful for people who use jOOQ’s parser and wish to access the parsed expression tree, or to transform SQL, e.g. to implement row level security in jOOQ. But occasionally, even with … Continue reading Traversing jOOQ…

jooq-developmentexpression treeexpression tree traversaljooqqom

28 Jan 2022

lukaseder 1 min read

A while ago, jOOQ has added the org.jetbrains:annotations dependency to the jOOQ API, in order to annotate return types with nullability information. For example, the entire DSL is non-nullable: It makes sense to give this guarantee especially to kotlin users, as they can get rid of some of the more complex types involving things like … Continue reading Detect Accidental…

jooq-developmentblockingjetbrains annotationsjooqnon-blocking

5 Jan 2022

lukaseder 1 min read

This release tackles two long standing and complex feature requests that usershave asked us to offer for a long time: a public API for manipulating jOOQ’squery object model (QOM), and spatial support. New Query Object Model (QOM) Every jOOQ query is modeled as an expression tree constructed via our intuitiveDSL. For some use-cases there exist … Continue reading 3.16.0 Release…

jooq-developmentexpression treegisjooqjooq 3.16

20 Aug 2021

lukaseder 1 min read

jOOQ has been around for a while – since around 2009 as a publicly available library, and since 2013 as a commercially licensed product. A lot of things have happened in 12 years. Here are 10 things that you maybe didn’t know about jOOQ. 1. eq, ne, gt, ge, lt, le are inspired by XSLT … Continue reading 10 Things…

jooq-developmentapi designfun factshistoryjooq

27 Jul 2021

lukaseder 1 min read

It’s been almost 1 year now since jOOQ 3.14 was released in October 19, 2020 with SQL/JSON (and SQL/XML) support. Half a year later, we’ve released jOOQ 3.15 with MULTISET support, which builds on top of these features to offer type-safe nested collections, the way every ORDBMS should implement them. Building (dogfooding) on top of … Continue reading Standard SQL/JSON…

jooq-developmentsqljooqjsonmariadb

15 Jul 2021

lukaseder 1 min read

One of the biggest new features of the recently released jOOQ 3.15 is its new support for reactive querying via R2DBC. This has been a highly popular feature request, and we finally delivered on it. You can continue using jOOQ the way you were used to, providing you with type safe, embedded SQL in Java, … Continue reading Reactive SQL…

jooq-developmentasyncjooqnonblockingr2dbc

6 Jul 2021

lukaseder 1 min read

R2DBC What a lot of users have been waiting for: jOOQ 3.15 is reactive, thanks to the new native R2DBC integration. Recent versions already implemented the reactive streams Publisher SPI, but now we’re not cheating anymore. We’re not longer blocking. Just wrap your R2DBC ConnectionFactory configured jOOQ query in a Flux (or any reactive streams … Continue reading 3.15.0 Release…

jooq-developmentapache ignitecreate functioncreate procedurecreate trigger

lukaseder 1 min read

This is how SQL should have been used all along. They called it The Third Manifesto, ORDBMS, or other things. Regrettably, it never really took off. Because most vendors didn’t adopt it. And those who did, didn’t agree on syntax. But this is about to change. Thanks to the now ubiquitous SQL/JSON support (which jOOQ … Continue reading jOOQ 3.15’s…

jooq-developmentdb2javajooqjson

30 Mar 2021

lukaseder 1 min read

jOOQ’s DSL, like any fluent API, has one big caveat. It’s very easy to forget to call .execute(). And when you do, chances are, you’re going to be staring at your code for minutes, because everything looks perfect: Staring… staring… staring… Why is it not inserting that row? “Aaaah, not again!!” This is how it’s … Continue reading Never Again…

jooq-developmentcheckreturnvalueexecuteintellijjetbrains

10 Feb 2021

lukaseder 1 min read

In the past years, we’ve invested a lot of effort into improving our procedural language capabilities in jOOQ. What started with a simple internal API to support the emulations of DDL clauses like these: … evolved into a full fledged API for all sorts of procedural logic executed in your database server. Anonymous blocks The … Continue reading Translating Stored…

jooq-developmentsqlbabelfishdatabase migrationpgplsql

8 Feb 2021

lukaseder 1 min read

So, @rotnroll666 nerd sniped me again. Apparently, the Neo4j Cypher query language supports arbitrary reductions, just like any functional collection API, oh say, the JDK Stream API: SQL doesn’t have this, yet it would be very useful to be able to occasionally do that. An arbitrary reduction can be implemented “easily” in SQL. Let’s look … Continue reading Implementing a…

jooq-developmentsqlaggregate functionscustom aggregate functionfunctional programming

4 Feb 2021

lukaseder 1 min read

Over the past 13 years, jOOQ has accrued quite some internal features, which you, the user, are not exposed to. One very interesting feature is the capability for any arbitrary jOOQ expression tree element to push a SQL fragment up to a higher level. How does it work? The jOOQ expression tree model When you … Continue reading jOOQ Internals:…

jooq-developmentfirebirdimplicit joinjooqlocal variables

17 Nov 2020

lukaseder 1 min read

While jOOQ is mostly being used as an internal SQL DSL for embedded, dynamic SQL in Java, where it offers the best solution on the market, jOOQ is increasingly also used for one of its secondary features: Its parser. Having been introduced in jOOQ 3.9 primarly for the purpose of being able to parse DDL … Continue reading Automatically Transform…

jooq-developmentsqlansi joinimplicit joinold join style

20 Oct 2020

lukaseder 1 min read

jOOQ 3.14 has been released with support for SQL/XML, SQL/JSON, Kotlin code generation, embeddable types, and domain types, synthetic constraints, better MERGE support, and more SQL transformations. In this release, we’ve sorted our github issues according to user feedback and finally implemented some of the most wanted features, which include better Kotlin support, embeddable types, … Continue reading jOOQ 3.14…

jooq-developmentjooqrelease notes

9 Oct 2020

lukaseder 1 min read

One of the main features of ORMs is M as in Mapping. Libraries like jOOQ help auto-mapping flat or nested database records onto Java classes that have the same structure as the SQL result set. The following has always been possible in jOOQ, assuming PostgreSQL’s INFORMATION_SCHEMA (using the generated code from the jOOQ-meta module): The … Continue reading Nesting Collections…

jooq-developmentsqljooqjsonnested collections

5 May 2020

lukaseder 1 min read

SQL Server supports transforming flat tabular SQL result sets into hierarchical structures by convention using the convenient FOR XML or FOR JSON syntaxes. This is really convenient and less verbose than the standard SQL/XML or SQL/JSON APIs – although the standard ones are more powerful. In this blog post, I’d like to show a few … Continue reading Using SQL…

jooq-developmentsqldb2jsonmariadb

25 Feb 2020

lukaseder 1 min read

Deprecation notice After encountering numerous problems building the jOOQ-refaster module in various JDK versions and after receiving no feedback from the community about this feature, we have decided to remove it again in jOOQ 3.15: https://github.com/jOOQ/jOOQ/issues/10803 Starting with jOOQ 3.13, we’re offering a new module called jOOQ Refaster, which provides refaster templates for automatic API … Continue reading Use the…

jooq-developmentchecker frameworkerrorpronejooqrefaster

25 Oct 2019

lukaseder 1 min read

Dogfooding, or eating your own dog food, is a practice that all product developers should implement all the time. According to wikipedia: Dogfooding, occurs when an organization uses its own product. This can be a way for an organization to test its products in real-world usage. Hence dogfooding can act as quality control, and eventually … Continue reading Dogfooding in…

jooq-developmentmigrationssqldatabase change managementdatabase migrations

16 Apr 2019

22 Nov 2018

5 Nov 2018

lukaseder 1 min read

While jOOQ is not a full fledged ORM (as in an object graph persistence framework), there is still some convenience available to avoid hand-writing boring SQL for every day CRUD. That’s the UpdatableRecord API. It has a few very useful features, including: A 1:1 mapping to the underlying table Every UpdatableRecord is mapped on a … Continue reading How to…

jooq-developmentactive recordcrudjooqorm

7 Jun 2018

lukaseder 1 min read

Today, jOOQ 3.11 has been released with support for 4 new databases, implicit joins, diagnostics, and much more New Databases Supported At last, 4 new SQL dialects have been added to jOOQ! These are: jOOQ Professional Edition Aurora MySQL Edition Aurora PostgreSQL Edition Azure SQL Data Warehouse jOOQ Enterprise Edition Teradata Implicit Joins One of … Continue reading jOOQ 3.11…

jooq-developmentanonymous blocksauroradiagnosticslistenerimplicit join

6 Jun 2018

lukaseder 1 min read

In this much overdue article, I will explain why I think that in almost all cases, you should implement a “database first” design in your application’s data models, rather than a “Java first” design (or whatever your client language is), the latter approach leading to a long road of pain and suffering, once your project … Continue reading Truth First,…

javajooq-developmentmigrationscode generationdatabase first

1 Apr 2018

13 Mar 2018

lukaseder 1 min read

The SQL standard is a nice thing. But it’s a standard. And as such, while it may provide good guidelines on how to implement some SQL features, most dialects deviate from it in one way or another (sometimes drastically, cheers, MySQL). But that doesn’t have to be a bad thing. Innovation is not driven by … Continue reading Top 10…

jooq-developmentsqlemulationjavajooq

20 Feb 2018

lukaseder 1 min read

One of the biggest contributors to SQL syntax verbosity is the need to explicitly JOIN every table that somehow contributes to the query, even if that contribution is “trivial”. When looking at the Sakila database, an example could be seen easily when fetching customer data: That single access to the country information cost us 3 … Continue reading Type Safe…

javajooq-developmentsqldqlexplicit join

15 Dec 2017

lukaseder 1 min read

When working with Oracle stored procedures, it is not uncommon to have debug log information available from DBMS_OUTPUT commands. For instance, if we have a procedure like this: The procedure works just the same, regardless if we’re reading the output from the DBMS_OUTPUT call. It is there purely for logging purposes. Now, if we call … Continue reading How to…

javajooq-developmentsqldbms outputjdbc

1 Nov 2017

lukaseder 1 min read

In this post, we’re going to discuss a couple of recent efforts to squeeze roughly 10% in terms of speed out of jOOQ by iterating on hotspots that were detected using JMC (Java Mission Control) and then validated using JMH (Java Microbenchmark Harness). This post shows how to apply micro optimisations to algorithms where the … Continue reading Squeezing Another…

javajooq-developmentbenchmarksjava 8java 9

25 Jul 2017

lukaseder 1 min read

jOOQ has been around for a while now (since 2009!) and by now we can say we’ve seen quite a bit of things about the SQL and Java languages. Some of our design decisions are particular in the way jOOQ thinks about programming with SQL. These include: Nullability (let’s stop fighting it) Value types (let’s … Continue reading 5 Things…

jooq-developmentsqldynamic sqlfunctional relational mappingjooq

24 Jul 2017

lukaseder 1 min read

In recent months, there had been some really exciting news from the MySQL team: (Recursive) Common Table Expressions in MySQL Introducing Window Functions These two SQL standard language features are among the most powerful SQL features that are available from most other databases. I frequently include them in conference talks about SQL (see my article … Continue reading jOOQ 3.10…

jooq-developmentsqlcommon table expressionshierarchical sqljooq

8 Feb 2017

lukaseder 1 min read

Earlier this week, I’ve blogged about how to execute SQL batches with JDBC and jOOQ. This was useful for the MySQL, SQL Server, and Sybase users among you. Today, we’ll discuss a slightly more difficult task, how to fetch Oracle 12c implicit cursors – which are essentially the same thing. What’s an implicit cursor? Oracle … Continue reading How to…

jooq-developmentsqlbatchimplicit cursorsjdbc

10 Jan 2017

lukaseder 1 min read

SQL Server has this nice feature called table-valued parameters (TVP), where users can pass table variables to a stored procedure for bulk data processing. This is particularly nice when the stored procedure is an inline table valued function, i.e. a function that returns a table as well. For instance: The above function creates a cross … Continue reading jOOQ 3.10…

jooq-developmentsqljooqsql serverstored procedures

6 Jan 2017

lukaseder 1 min read

One of jOOQ‘s most powerful features is the capability of introducing custom data types, pretending the database actually understands them. For instance, when working with SQL TIMESTAMP types, users mostly want to use the new JSR-310 LocalDateTime, rather than the JDBC java.sql.Timestamp type. In jOOQ 3.9+, this is a no brainer, as we’ve finally introduced … Continue reading How to…

javajooq-developmentconvertercustom typesjooq

8 Nov 2016

lukaseder 1 min read

Some of the biggest limitations when working with Oracle PL/SQL from Java is the lack of support for a variety of PL/SQL features through the JDBC interface. This lack of support is actually not limited to JDBC, but also extends to Oracle SQL. For instance, if you’re using the useful PL/SQL BOOLEAN type as such: … Continue reading Use jOOQ…

jooq-developmentsqljooqoraclepl sql

30 Jun 2016

lukaseder 1 min read

When people start creating commercially licensed software (like we did, in 2013 with jOOQ), there is always the big looming question: What do I do about piracy? I’ve had numerous discussions with fellow entrepreneurs about this topic, and this fear is omnipresent. There has also been a recent discussion on reddit, titled “prevent sharing of … Continue reading With Commercial…

businessjooq-developmentopen-sourcecommercial licensingcompliance

9 May 2016

lukaseder 1 min read

Java 8 introduced JSR-308, which added new annotation capabilities to the Java language. Most importantly: Type annotations. It is now possible to design monsters like the below: The code displayed in that tweet really compiles. Every type can be annotated now, in order to enhance the type system in any custom way. Why, you may … Continue reading JSR-308 and…

javajava 8jooq-developmentannotatiomaniaannotations

8 Feb 2016

lukaseder 1 min read

One of the most awesome features of the Oracle database is Oracle AQ: Oracle Database Advanced Queuing. The AQ API implements a full fledged, transactional messaging system directly in the database. In a classic architecture where the database is at the center of your system, with multiple applications (some of which written in Java, others … Continue reading Using Oracle…

javajava 8jooq-developmentinfinite streamjooq

28 Jan 2016

lukaseder 1 min read

Just now, we implemented a nice little feature in jOOQ’s code generator: https://github.com/jOOQ/jOOQ/issues/4974 It detects whenever the jOOQ code generator runs a slow query to reverse engineer schema meta information. Why? In our development and integration test environment, we don’t have huge schemas with all the different performance edge cases put in place. For instance, … Continue reading How to…

jooq-developmentsqlcode generatorexecutelistenerjooq

5 Jan 2016

lukaseder 1 min read

jOOQ is an internal domain-specific language (DSL), modelling the SQL language (external DSL) in Java (the host language). The main mechanism of the jOOQ API is described in this popular article: The Java Fluent API Designer Crash Course. Anyone can implement an internal DSL in Java (or in most other host languages) according to the … Continue reading A Curious…

javajooq-developmentapiapi designdomain specific language

1 Apr 2015

lukaseder 1 min read

I’ve recently had a very interesting discussion with Sebastian Gruber from Ergon, a very early jOOQ customer, whom we’re in close touch with. Talking to Sebastian has lead our engineering team to the conclusion that we should completely rewrite the jOOQ API. Right now, we already have lots of generics for various purposes, e.g. Generics … Continue reading Don’t be…

javajooq-developmentbackwards compatibilitygeneric genericsgeneric types

5 Sept 2014

lukaseder 1 min read

ERD (Entity Relationship Diagrams) are a great way of designing and visualising your database model. There is a variety of vendors offering free and commercial ERD tools. Vertabelo by E-Point is a SaaS product where you can design and manage your database schema online. For instance, the jOOQ example database can be modelled as such: … Continue reading Stop Manually…

jooq-developmentdatabase exportdatabase importerdjooq

2 Sept 2014

lukaseder 1 min read

CHECK constraints are already pretty great when you want to sanitize your data. But there are some limitations to CHECK constraints, including the fact that they are applied to the table itself, when sometimes, you want to specify constraints that only apply in certain situations. This can be done with the SQL standard WITH CHECK … Continue reading Awesome SQL…

jooq-developmentsqlcheck constraintcheck optionconstraints

30 Jul 2014

7 Jul 2014

lukaseder 1 min read

Table-valued functions are an awesome thing. Many databases support them in one way or another and so does PostgreSQL. In PostgreSQL, (almost) everything is a table. For instance, we can write: … and believe it or not, this is a table! We can write: And the above will return: +----+ | v2 | +----+ | … Continue reading PostgreSQL’s Table-Valued…

javajooq-developmentsqljooqpostgresql

25 Jun 2014

lukaseder 1 min read

When performing database migrations, we at Data Geekery recommend using jOOQ with Flyway – Database Migrations Made Easy. In this post, we’re going to look into a simple way to get started with the two frameworks. Philosophy There are a variety of ways how jOOQ and Flyway could interact with each other in various development … Continue reading Flyway and…

javajooq-developmentmigrationssqldatabase migration

23 Jun 2014

lukaseder 1 min read

Most databases that support default values on their column DDL, it is also possible to actually alter that default. An Oracle example: Unfortunately, this isn’t possible in SQL Server, where the DEFAULT column property is really a constraint, and probably a constraint whose name you don’t know because it was system generated. But luckily, jOOQ … Continue reading SQL Server…

jooq-developmentsqlalter tablecolumn defaultddl

29 May 2014

lukaseder 1 min read

This week, Timo Westkämper from QueryDSL has announced feature completeness on the QueryDSL user group, along with his call for contributions and increased focus on bugfixes and documentation. Timo and us, we have always been in close contact, observing each other’s products. In the beginning of jOOQ in 2009, QueryDSL was ahead of us. But … Continue reading QueryDSL vs.…

javajooq-developmentsqlfeature completefeature-completeness

19 Feb 2014

lukaseder 1 min read

Recently, we’ve added support for the MS Access database in jOOQ 3.3. This may well have been our hardest integration so far. The MS Access database has its ways, and many of them, too. But luckily, jOOQ’s internal SQL transformation abilities are already very advanced, as we’ve shown previously in a blog post about the … Continue reading An MS…

jooq-developmentsqljooqms accessmulti-record insert