【发布时间】:2018-12-31 19:25:13
【问题描述】:
我使用 java --add-modules java.xml.bind -classpath jooq-3.11.3.jar;jooq-meta-3.11.3.jar;jooq-codegen-3.11.3.jar;postgresql-42.2.4.jar;. org.jooq.codegen.GenerationTool jooq.xml 为我的 PostgreSQL 10 USER 表自动生成 JOOQ 代码。
codegen 工具成功完成,但是我的程序无法编译,因为自动生成的代码中有几个 Java 语法错误。
一些例子:
PgClass.java
/**
* @deprecated Unknown data type. Please define an explicit {@link org.jooq.Binding} to specify how this type should be handled. Deprecation can be turned off using <deprecationOnUnknownTypes/> in your code generator configuration.
*/
@java.lang.Deprecated
public final TableField<PgClassRecord, Object> RELPARTBOUND = createField("relpartbound", , this, "");
编译器告诉我java: illigal start of expression
PgIndex.java:
/**
* The column <code>pg_catalog.pg_index.indoption</code>.
*/
public final TableField<PgIndexRecord, Object[]> INDOPTION = createField("indoption", .getArrayDataType(), this, "");
编译器告诉我java: as of release 8, 'this' is allowed as the parameter name for the receiver type only, which has to be the first parameter
编辑:
jooq.xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration xmlns="http://www.jooq.org/xsd/jooq-codegen-3.11.0.xsd">
<jdbc>
<driver>org.postgresql.Driver</driver>
<url>jdbc:postgresql://localhost:5432/timecoder-api-dev</url>
<user>postgres</user>
<password></password>
</jdbc>
<generator>
<database>
<name>org.jooq.meta.postgres.PostgresDatabase</name>
<includes>.*</includes>
</database>
<target>
<packageName>persistence.database.generated</packageName>
<directory>K:\Data\Dev\Git\timecoder-api\src</directory>
</target>
</generator>
</configuration>
- jOOQ:3.11.3
- Java:1.8.0_181
- 数据库(包括供应商):PostgreSQL 10
- 操作系统:Windows 10
我还在 GitHub 上创建了一个问题:https://github.com/jOOQ/jOOQ/issues/7684
【问题讨论】:
-
如果使用旧版本的 Java 完成这项工作,是否可行?
-
你能发布你的 jooq.xml 吗?我不认为这是一个 jooq 问题 - 似乎您包含所有模式,而不仅仅是您需要的模式
-
在帖子中添加了 jooq.xml。请再看一看。
标签: java postgresql jdbc jooq