PostHole
Compose Login
You are browsing eu.zone1 in read-only mode. Log in to participate.
rss-bridge 2022-09-06T12:30:37+00:00

A Brief Overview over the Most Common jOOQ Types

For new users working with jOOQ for the first time, the number of types in the jOOQ API can be overwhelming. The SQL language doesn’t have many such “visible” types, although if you think about SQL the way jOOQ does, then they’re there just the same, but hidden from users via an English style syntax. … Continue reading A Brief Overview over the Most Common jOOQ Types →


A Brief Overview over the Most Common jOOQ Types

Posted on September 6, 2022November 13, 2024 by lukaseder

This overview will list the most important jOOQ types in a cheat sheet form.

Configuration types

The Configuration is the single most important configuration type, which contains references to all other types of configuration, Settings, custom SPI implementations, JDBC or R2DBC Connection, etc. SPIs include:

And many more, which you can see from the Configuration Javadoc

It is made available from every Scope type in the API, see below for details

Scopes

The Scope types are various types that are created “in the scope” of a Configuration, and as such can provide access to all of the Configuration‘s contained objects and SPIs. This design allows for extremely flexible, programmatic dependency injection throughout the internals of jOOQ. Some of the most important Scope types include:

  • Context: Used for a single traversal of a QueryPart expression tree to produce a SQL string and / or a list of bind variables.

For other types, refer to the Scope Javadoc.

Settings

Settings are mostly scalar flags that specify detailed behaviour in jOOQ. Some select examples include:

  • Settings.fetchSize: To specify the default JDBC fetchSize on the created Statement and PreparedStatement

As of jOOQ 3.17, there are over 160 such settings, so we can’t list them all here. For more details, refer to the Settings Javadoc.

DSL types

The DSL API is the most important API to work with jOOQ. It comes in 2 flavours.

The static DSL

The static DSL contains entry points to every type of QueryPart construction DSLs, including:

… and a lot more. All of these types are constructed statically, and as such, they do not have any Configuration attached.

The “context” DSL

The “context” DSL, represented by the DSLContext type, only offers constructing QueryPart types that profit from being created “in the context” of a Configuration. This is mainly just including:

A Query that has been constructed from the DSLContext type can be executed directly by using Query.execute()) or ResultQuery.fetch()), or many other execution methods, including asynchronous or reactive ones.

Step types

Throughout the DSL API, you will see so-called “Step” types, i.e. types with a “Step” suffix, such as e.g. SelectFromStep, which is the “Step” that gives access to the Select DSL’s FROM clause.

You should never reference these types directly, nor see them in your own code. They are intermediate DSL artifacts

QueryPart types

QueryPart is the common base type of the entire jOOQ expression tree, or model API. Every type that you construct with the DSL API will extend QueryPart, for example:


[...]

---

*[Original source](https://blog.jooq.org/a-brief-overview-over-the-most-common-jooq-types/)*
Reply