首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >无法编译自动生成的JOOQ代码,因为存在多个java错误

无法编译自动生成的JOOQ代码,因为存在多个java错误
EN

Stack Overflow用户
提问于 2018-07-24 16:35:49
回答 2查看 421关注 0票数 4

我使用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

代码语言:javascript
复制
/**
* @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:

代码语言:javascript
复制
/**
* 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

代码语言:javascript
复制
<?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>

1.8.0_181

  • Database

  • jOOQ: 3.11.3

  • Java: 1.8.0_181

  • Database(含供应商):Windows 10

  • 操作系统:Windows 10

我还在GitHub上创建了一个问题:https://github.com/jOOQ/jOOQ/issues/7684

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-07-30 15:49:52

感谢您的报道。这是代码生成器中的一个错误:https://github.com/jOOQ/jOOQ/issues/7692

该问题将在jOOQ 3.12.0和3.11.4中修复

票数 1
EN

Stack Overflow用户

发布于 2018-07-24 21:38:49

我的数据库表在Postgres schema "public“中。我忘了在我的jooq.xml中添加<inputSchema>public</inputSchema>。现在它工作得很好:)

jooq.xml

代码语言:javascript
复制
<?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>
      <inputSchema>public</inputSchema>
      <includes>.*</includes>
    </database>
    <target>
      <packageName>persistence.database.generated</packageName>
      <directory>K:\Data\Dev\Git\timecoder-api\src</directory>
    </target>
  </generator>
</configuration>
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51494099

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档