Configuring jOOQ to generate POJOs
So far, we have used our own POJOs as our primary Data Transfer Objects (DTOs). This is a common approach in layered applications such as Spring Boot applications.
The Office
and Order
POJOs are Java mirrors of the OFFICE
and ORDER
tables, since our queries fetch all the columns from these tables. On the other hand, the CustomerAndOrder
POJO maps columns from two different tables, CUSTOMER
and ORDER
. More precisely, it maps CUSTOMER_NAME
from CUSTOMER
and ORDER_DATE
from ORDER
.
Optionally, jOOQ can generate POJOs on our behalf via the jOOQ Code Generator. In Maven, this feature can be enabled via the following configuration into the <generator>
tag:
<generator> ... <generate> <pojos>true</pojos> </generate> ... </generator>
Additionally, jOOQ can add to the generated POJOs a set of Bean Validation API annotations to convey...