jOOQ 3.14.15 is not compatible with H2 2.x

The following project will fail to generate classes:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.7.0</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com.example</groupId>
    <artifactId>jooqh2issue</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>jooqh2issue</name>
    <description>jooqh2issue</description>
    <properties>
        <java.version>17</java.version>
        <db.url>jdbc:h2:${project.build.directory}/flyway-code-gen</db.url>
        <db.username>sa</db.username>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jooq</artifactId>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.jooq</groupId>
                <artifactId>jooq-codegen-maven</artifactId>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jdbc>
                        <url>${db.url}</url>
                        <user>${db.username}</user>
                    </jdbc>
                    <generator>
                        <database>
                            <name>org.jooq.meta.h2.H2Database</name>
                            <includes>.*</includes>
                            <schemata>
                                <schema>
                                    <inputSchema>PUBLIC</inputSchema>
                                    <outputSchemaToDefault>true</outputSchemaToDefault>
                                </schema>
                            </schemata>
                        </database>
                        <generate>
                            <deprecated>false</deprecated>
                            <javaTimeTypes>true</javaTimeTypes>
                        </generate>
                        <target>
                            <packageName>ac.simons.biking2.db</packageName>
                            <directory>target/generated-sources/jooq</directory>
                        </target>
                    </generator>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

Error will be

[WARNING] SQL exception            : Exception while executing meta query: Genauigkeit ("2147483647") muss zwischen "1" und "1000000000" inklusive liegen
Precision ("2147483647") must be between "1" and "1000000000" inclusive; SQL statement:
select INFORMATION_SCHEMA.DOMAINS.DOMAIN_SCHEMA, INFORMATION_SCHEMA.DOMAINS.DOMAIN_NAME, INFORMATION_SCHEMA.DOMAINS.TYPE_NAME, INFORMATION_SCHEMA.DOMAINS.PRECISION, INFORMATION_SCHEMA.DOMAINS.SCALE, INFORMATION_SCHEMA.DOMAINS.IS_NULLABLE, INFORMATION_SCHEMA.DOMAINS.COLUMN_DEFAULT, INFORMATION_SCHEMA.DOMAINS.CHECK_CONSTRAINT from INFORMATION_SCHEMA.DOMAINS where (INFORMATION_SCHEMA.DOMAINS.DOMAIN_SCHEMA in (cast(? as varchar(2147483647))) and INFORMATION_SCHEMA.DOMAINS.TYPE_NAME <> 'ENUM') order by INFORMATION_SCHEMA.DOMAINS.DOMAIN_SCHEMA, INFORMATION_SCHEMA.DOMAINS.DOMAIN_NAME [90150-212]

If you think this is a bug in jOOQ, please report it here: https://github.com/jOOQ/jOOQ/issues/new

Note you can mute some exceptions using the configuration/onError flag

```sql
select
  INFORMATION_SCHEMA.DOMAINS.DOMAIN_SCHEMA,
  INFORMATION_SCHEMA.DOMAINS.DOMAIN_NAME,
  INFORMATION_SCHEMA.DOMAINS.TYPE_NAME,
  INFORMATION_SCHEMA.DOMAINS.PRECISION,
  INFORMATION_SCHEMA.DOMAINS.SCALE,
  INFORMATION_SCHEMA.DOMAINS.IS_NULLABLE,
  INFORMATION_SCHEMA.DOMAINS.COLUMN_DEFAULT,
  INFORMATION_SCHEMA.DOMAINS.CHECK_CONSTRAINT
from INFORMATION_SCHEMA.DOMAINS
where (
  INFORMATION_SCHEMA.DOMAINS.DOMAIN_SCHEMA in ('PUBLIC')
  and INFORMATION_SCHEMA.DOMAINS.TYPE_NAME <> 'ENUM'
)
order by
  INFORMATION_SCHEMA.DOMAINS.DOMAIN_SCHEMA,
  INFORMATION_SCHEMA.DOMAINS.DOMAIN_NAME```

this can be fixed by bumping jOOQ to 3.16.6

<jooq.version>3.16.6</jooq.version>

cc @lukaseder

Comment From: lukaseder

I don't think anything can be done here in Spring Boot 2.x, currently, as Spring Boot's baseline of Java 8 makes it impossible to have starters that require something newer, see also:

  • https://github.com/spring-projects/spring-boot/issues/26439#issuecomment-876464316
  • https://github.com/spring-projects/spring-boot/issues/28821#issuecomment-983559853
  • https://github.com/spring-projects/spring-boot/issues/30760#issuecomment-1108318920

Personally, I think that Spring Boot should be able to handle this kind of situation, as there is no guarantee in the future that we'll ever be spoiled again with a commonly agreed upon (totally coincidental!) baseline of something like Java 8 everywhere. Java 8 was only the baseline everywhere, because Java 9 took a very long time to release, and only very few important improvements (for users) were added to the language / JDK for quite a while.

In the meantime, jOOQ is by far no longer the only library that has increased the baseline to something newer.

Comment From: wilkinsona

It's unfortunate, but there's nothing we can do about this in Boot 2.x. I've added a section to the release notes to offer some guidance.

Comment From: lukaseder

Regarding that link:

Unfortunately, there is no version of jOOQ that is compatible with both Java 8 and H2 2.x.

The jOOQ 3.16 Professional Edition still supports Java 8 and both H2 1.4 and 2.x

Comment From: wilkinsona

Thanks, @lukaseder. I've tweaked the release notes accordingly:

There is no open source version of jOOQ that is compatible with both Java 8 and H2 2.x. If you are using Java 11, consider using the jooq.version property to upgrade to jOOQ 3.16 or later. If you are using Java 8 and cannot upgrade, consider purchasing jOOQ Professional Edition, migrating from H2 to another database or, as a last resort, downgrading to H2 1.4.x.

Comment From: michael-simons

I wonder if you could help people with new projects / demos generated with start.spring.io.

On JDK17 you could overwrite the managed jOOQ version in the build descriptor and / or disable the selection of H2 when jOOQ is selected (generally or on JDK 8 only).

But anyway, it’s just an idea.

Comment From: wilkinsona

That's a good idea. Thank you, @michael-simons. I've opened https://github.com/spring-io/start.spring.io/issues/925.