Reader small image

You're reading from  jOOQ Masterclass

Product typeBook
Published inAug 2022
Reading LevelBeginner
PublisherPackt
ISBN-139781800566897
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Anghel Leonard
Anghel Leonard
author image
Anghel Leonard

Anghel Leonard is a Chief Technology Strategist and independent consultant with 20+ years of experience in the Java ecosystem. In daily work, he is focused on architecting and developing Java distributed applications that empower robust architectures, clean code, and high-performance. Also passionate about coaching, mentoring and technical leadership. He is the author of several books, videos and dozens of articles related to Java technologies.
Read more about Anghel Leonard

Right arrow

Extending the jOOQ built-in DAO

Let's assume that you have configured the jOOQ generator to output the generated DAO layer in the jooq.generated.tables.daos package. While the generated DAO exposes common query methods such as insert(), update(), delete(), and a few specific queries of the fetchBy...() or fetchRange...() types, we want to extend it with our own query methods.

Important Note

This is one of my favorite ways of writing a DAO layer in a Spring Boot and jOOQ application.

The jOOQ DAO layer contains a set of generated classes that mirrors the database tables and extends the built-in org.jooq.impl.DAOImpl class. For example, the jooq.generated.tables.daos.SaleRepository class (or, jooq.generated.tables.daos.SaleDao if you keep the default naming strategy used by jOOQ) corresponds to the SALE table. In order to extend SaleRepository, we have to take a quick look at its source code and highlight a part of it as follows:

@Repository
public class SaleRepository...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
jOOQ Masterclass
Published in: Aug 2022Publisher: PacktISBN-13: 9781800566897

Author (1)

author image
Anghel Leonard

Anghel Leonard is a Chief Technology Strategist and independent consultant with 20+ years of experience in the Java ecosystem. In daily work, he is focused on architecting and developing Java distributed applications that empower robust architectures, clean code, and high-performance. Also passionate about coaching, mentoring and technical leadership. He is the author of several books, videos and dozens of articles related to Java technologies.
Read more about Anghel Leonard