April 2018
Intermediate to advanced
202 pages
4h 48m
English
You can run queries with jOOQ by creating a DSLContext instance. One way of getting this instance is with the DSL.using method:
Connection connection = pool.getConnection();DSLContext dslContext = DSL.using(connection);
With this, you can easily run queries using the fluent API offered by jOOQ. For example, to get all the rows in the messages table, you can use the following:
List<MessagesRecord> messages = dslContext.select() .from(MESSAGES) .fetchInto(MessagesRecord.class);
The MessagesRecord class and MESSAGES instance are provided by the code generated by jOOQ. This makes the previous query type-safe.
Read now
Unlock full access