2

例如,所有为表生成的类如下所示:

SuppressWarnings({"all", "unchecked", "rawtypes"})
public class TableName extends TableImpl<TableNameRecord> {

    private static final long serialVersionUID = 1L;

    public static final TableName TABLE_NAME = new TableName();

    @Override
    public Class<TableNameRecord> getRecordType() {
        return TableNameRecord.class;
    }
   ... (more contructors)  
}

Maven:
代码生成:

<plugin>
    <groupId>org.jooq</groupId>
    <artifactId>jooq-codegen-maven</artifactId>
    <version>3.16.1</version>
    <executions>
        <execution>
            <phase>generate-sources</phase>
            <goals>
                <goal>generate</goal>
            </goals>
        </execution>
    </executions>
    <dependencies>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>42.3.1</version>
        </dependency>
    </dependencies>
    <configuration>
        <jdbc>
            <driver>org.postgresql.Driver</driver>
            <url>'db-url'</url>
            <user>'user-name'</user>
            <password>'pswd'</password>
        </jdbc>
        <generator>
            <database>
                <name>org.jooq.meta.postgres.PostgresDatabase</name>
                <includes>.*</includes>
                <inputSchema>'my-schema'</inputSchema> 
                <excludes/>
            </database>
            <generate>
                <records>true</records>
            </generate>
            <target>
                <packageName>'package-name'</packageName>
                <directory>target/generated-sources/jooq</directory>
            </target>
        </generator>
    </configuration>
</plugin>

依赖项: jooq、jooq-meta、jooq-codegen
版本:3.16.1

怎么了?

4

1 回答 1

0

我添加了这个

<database>
      <includeTables>true</includeTables>
</database>

进行配置,它解决了我的问题

于 2022-01-14T16:01:48.773 回答