7.6. Creating SQL Queries Using jOOQ
Before we move on to the implementation of managers and grids, we will examine briefly how to work with the database via jOOQ. You can find the full documentation on this issue in the SQL-building section of the jOOQ documentation.
The org.jooq.impl.DSL
class is the main one from which jOOQ objects are created. It acts as a static factory for table expressions, column (or field) expressions, conditional expressions and many other parts of a query.
DSLContext
references the org.jooq.Configuration
object that configures the behavior of jOOQ during the execution of queries. Unlike with static DSL, with DSLContext you can to create SQL statements that are already “configured” and ready for execution.
In our application, DSLContext
is created in the getDsl
method of the JooqConfig
configuration class. Configuration for DSLContext
is returned by the getDslConfig
method. In this method we specify the Firebird dialect that we will use, the connection provider that determines how we get a connection via JDBC and the SQL query execution listener.