Generating code for two schemas of different vendors
Consider two schemas of different vendors – for instance, our classicmodels
schema for MySQL and PostgreSQL. Our goal is to generate the jOOQ artifacts for both schemas and execute queries against one or another.
Considering a Maven-based application, we can accomplish this task by using two <execution>
entries, for the flyway-maven-plugin
plugin and the jooq-codegen-maven
plugin. Here is the skeleton code for jooq-codegen-maven
(the complete code is available in the bundled code):
<plugin> <groupId>org.jooq</groupId> <artifactId>jooq-codegen-maven</artifactId> <executions> <execution> <id>generate-mysql</id> <phase>generate-sources</phase> <goals> ...