Module org.jooq
Package org.jooq.impl

Class DSL

java.lang.Object
org.jooq.impl.DSL
Direct Known Subclasses:
AccessDSL, ASEDSL, CUBRIDDSL, DB2DSL, DerbyDSL, FirebirdDSL, H2DSL, HanaDSL, HSQLDBDSL, InformixDSL, IngresDSL, MariaDBDSL, MySQLDSL, OracleDSL, PostgresDSL, RedshiftDSL, SQLiteDSL, SQLServerDSL, SybaseDSL, VerticaDSL

public class DSL extends Object
A DSL "entry point" providing implementations to the org.jooq interfaces.

The DSLContext and this DSL are the main entry point for client code, to access jOOQ classes and functionality. Here, you can instantiate all of those objects that cannot be accessed through other objects. For example, to create a Field representing a constant value, you can write:


 Field<String> field = DSL.val("Hello World")
 

Another example is the EXISTS clause, which you can apply to any SELECT to form a Condition:


 Condition condition = DSL.exists(DSL.select(...));
 

DSL and static imports

For increased fluency and readability of your jOOQ client code, it is recommended that you static import all methods from the DSL. For example:


 import static org.jooq.impl.DSL.*;

 public class Main {
   public static void main(String[] args) {
     DSL.select(val("Hello"), inline("World"));
     // DSL.val ^^^           ^^^^^^ DSL.inline
   }
 }
 

In order to use the "contextual DSL", call one of the various overloaded using(Configuration) methods:


 // Create and immediately execute a SELECT statement:
 DSL.using(connection, dialect)
    .selectOne()
    .fetch();
 
Author:
Lukas Eder
See Also: