Writing queries using a Java-based schema
Once jOOQ's Code Generator has done its job, we have access to the generated artifacts. Among these artifacts, we have the jooq.generated.tables
folder, which contains the database tables mirrored as Java code. The generated artifacts are placed in the specified /target
folder (in our case, target/generated-sources
) under the specified package name (in our case, jooq.generated
).
Important Note
Typically, you'll instruct the jOOQ Code Generator to store generated code under the /target
folder (Maven), /build
folder (Gradle), or /src
folder. Basically, if you choose the /target
or /build
folder, then jOOQ regenerates the code at each build; therefore, you are sure that sources are always up to date. Nevertheless, to decide which path fits best to your strategic case, consider reading Lukas Eder's answer from Stack Overflow: https://stackoverflow.com/questions/25576538/why-does-jooq-suggest-to-put-generated-code-under-target...