Tackling programmatic configuration
If you prefer programmatic configurations, then jOOQ exposes a fluent API (org.jooq.meta.jaxb.*
) that can be used for configuring code generation in programmatic fashion. First, for Maven, add the following dependency in pom.xml
:
<dependency> <groupId>org.jooq{.trial-java-8}</groupId> <artifactId>jooq-codegen</artifactId> </dependency>
Alternatively, in Gradle, add implementation 'org.jooq{.trial-java-8}:jooq-codegen'
.
Note that Configuration
refers to org.jooq.meta.jaxb.Configuration
, not org.jooq.Configuration
, which is used for creating DSLContext
and other jOOQ contexts.
This programmatic API mirrors the declarative approach and, therefore, is very intuitive. For instance, here it is the programmatic alternative of the declarative approach presented in the Configuring jOOQ to generate DAOs section for the MySQL classicmodels
schema:
Configuration configuration...