spring-bootjooqr2dbc

How to generate jooq classes with r2dbc driver in the pom file


is it possible to generate jooq classes with r2dbc driver in the pom file. e.g in the example below, replace the jdbc tags and have r2dbc. I am using jooq and r2dbc and I want to include jdbc in the as well.

<plugin>
                <groupId>org.jooq</groupId>
                <artifactId>jooq-codegen-maven</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jdbc>
                        <url>${env.DATABASE_URL}</url>
                        <user>${env.DATABASE_USER}</user>
                        <password>${env.DATABASE_PASS}</password>
                        <driver>${spring.datasource.driver}</driver>
                    </jdbc>
                    <generator>
                        <database>
                            <name>org.jooq.meta.mysql.MySQLDatabase</name>
                            <includePackages>false</includePackages>
                            <!--  <includeRoutines>false</includeRoutines>-->
                            <unsignedTypes>false</unsignedTypes>
                            <integerDisplayWidths>false</integerDisplayWidths>
                            <forcedTypes>
                                <forcedType>
                                    <name>INTEGER</name>
                                    <expression>.*</expression>
                                    <types>(?i:TINYINT)</types>
                                </forcedType>
                                <forcedType>
                                    <name>DOUBLE</name>
                                    <expression>.*</expression>
                                    <types>DECIMAL</types>
                                </forcedType>
                            </forcedTypes>
                            <schemata>
                                <schema>
                                    <inputSchema>myschema</inputSchema>
                                </schema>
                            </schemata>
                        </database>
                        <target>
                            <packageName>com.jooq.db</packageName>
                            <directory>target/generated-sources/jooq</directory>
                        </target>
                    </generator>
                </configuration>
            </plugin>

Solution

  • That's not possible. The code generator works with JDBC only. The hassle of making all of the code generation queries reactive adds absolutely no value to end users apart from the very minor convenience of being able to re-use the same driver for code generation and the runtime. Especially in the case of using the maven plugin, you can scope the JDBC driver dependency to be available to the plugin only, not the rest of your build or application.

    So, just use the JDBC driver for code generation, instead.