【问题标题】:jOOQ doesn't want to generate database resourcesjOOQ 不想生成数据库资源
【发布时间】:2019-11-27 16:05:15
【问题描述】:

即使数据库中有表,jOOQ 也不会从数据库中生成资源。

我已经检查了这个thread,但是在更改org.jooq.meta.sqlite.SQLiteDatabase 时它会让我出错

我也让代码自己生成数据库并稍后添加表,但是当再次运行它时仍然没有生成任何东西

jOOQ 版本是 3.11.11

pom.xml:

<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.db</groupId>
    <artifactId>test</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <maven.compiler.source>1.6</maven.compiler.source>
        <maven.compiler.target>1.6</maven.compiler.target>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq</artifactId>
            <version>3.11.11</version>
        </dependency>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq-meta</artifactId>
            <version>3.11.11</version>
        </dependency>
        <dependency>
            <groupId>org.jooq</groupId>
            <artifactId>jooq-codegen</artifactId>
            <version>3.11.11</version>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.jooq</groupId>
                <artifactId>jooq-codegen-maven</artifactId>
                <version>3.11.11</version>

                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>

                <dependencies>
                    <dependency>
                        <groupId>org.xerial</groupId>
                        <artifactId>sqlite-jdbc</artifactId>
                        <version>3.27.2.1</version>
                    </dependency>
                </dependencies>

                <configuration>
                    <jdbc>
                        <driver>org.sqlite.JDBC</driver>
                        <url>jdbc:sqlite:TestDB.db</url>
                    </jdbc>
                    <generator>
                        <database>
                            <name>org.jooq.meta.sqlite.SQLiteDatabase</name>
                            <includes>.*</includes>
                            <excludes></excludes>
                            <inputSchema>public</inputSchema>
                        </database>
                        <target>
                            <packageName>test.generatedclasses</packageName>
                            <directory>${basedir}\src\main\java</directory>
                        </target>
                    </generator>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>```

I also get this: 
[INFO]   annotations (generated): true
[INFO]   annotations (JPA: any) : false
[INFO]   annotations (JPA: version): 
[INFO]   annotations (validation): false
[INFO]   comments               : true
[INFO]   comments on attributes : true
[INFO]   comments on catalogs   : true
[INFO]   comments on columns    : true
[INFO]   comments on keys       : true
[INFO]   comments on links      : true
[INFO]   comments on packages   : true
[INFO]   comments on parameters : true
[INFO]   comments on queues     : true
[INFO]   comments on routines   : true
[INFO]   comments on schemas    : true
[INFO]   comments on sequences  : true
[INFO]   comments on tables     : true
[INFO]   comments on udts       : true
[INFO]   daos                   : false
[INFO]   deprecated code        : true
[INFO]   global references (any): true
[INFO]   global references (catalogs): true
[INFO]   global references (keys): true
[INFO]   global references (links): true
[INFO]   global references (queues): true
[INFO]   global references (routines): true
[INFO]   global references (schemas): true
[INFO]   global references (sequences): true
[INFO]   global references (tables): true
[INFO]   global references (udts): true
[INFO]   indexes                : true
[INFO]   instance fields        : true
[INFO]   interfaces             : false
[INFO]   interfaces (immutable) : false
[INFO]   javadoc                : true
[INFO]   keys                   : true
[INFO]   links                  : true
[INFO]   pojos                  : false
[INFO]   pojos (immutable)      : false
[INFO]   queues                 : true
[INFO]   records                : true
[INFO]   routines               : true
[INFO]   sequences              : true
[INFO]   table-valued functions : true
[INFO]   tables                 : true
[INFO]   udts                   : true
[INFO]   relations              : true

I have also executed "SELECT FROM" query and it worked fine

【问题讨论】:

    标签: java sqlite maven jooq


    【解决方案1】:

    SQLite 不支持架构。删除你的&lt;inputSchema&gt;

    【讨论】:

    • 好的,谢谢,但我收到了这个警告:WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.jooq.tools.reflect.Reflec 正常吗?
    • @MordechaiHadad:谢谢。这在 jOOQ 3.12 中无关且已修复:github.com/jOOQ/jOOQ/issues/7950。您可以放心地忽略它。
    猜你喜欢
    • 2018-12-31
    • 2021-12-20
    • 2022-07-19
    • 2021-04-28
    • 2020-09-01
    • 2010-09-12
    • 2022-07-20
    • 2022-01-12
    相关资源
    最近更新 更多