April 2018
Intermediate to advanced
202 pages
4h 48m
English
Let's say you have a database schema to manage books and authors. A possible SQL query for such a database could look like the following:
SELECT AUTHOR.FIRST_NAME, AUTHOR.LAST_NAMEFROM AUTHORORDER BY AUTHOR.LAST_NAME ASC
jOOQ allows you to write this same SQL query, but in Java:
dslContext.select(AUTHOR.FIRST_NAME, AUTHOR.LAST_NAME) .from(AUTHOR) .orderBy(AUTHOR.LAST_NAME.asc()
As you can see, the syntax is quite close to actual SQL. You might be wondering where the AUTHOR object and its properties come from. They come from code generated by jOOQ. The code generation process can be automated with Maven. The following code shows how to configure the jooq-codegen-maven plugin in your pom.xml:
<plugin> ...Read now
Unlock full access