java - JOOQ 生成器 : Missing name

标签 java postgresql gradle jooq

我正在尝试使用 Postgres 和 Gradle 设置 JOOQ。

每当我运行生成任务时,我都会得到 ~ 20 不明确的类型名称:

Ambiguous type name : The object pg_catalog.generate_series generates a type one.dbtest.db.pg_catalog.tables.GenerateSeries which conflicts with the existing type one.dbtest.db.pg_catalog.tables.GenerateSeries on some operating systems. Use a custom generator strategy to disambiguate the types. Ambiguous type name : The object pg_catalog.generate_series generates a type one.dbtest.db.pg_catalog.tables.GenerateSeries which conflicts with the existing type one.dbtest.db.pg_catalog.tables.GenerateSeries on some operating systems. Use a custom generator strategy to disambiguate the types.

还有数百个:

Missing name : Object jsonb_exists_all holds a column without a name at position 2 Missing name : Object jsonb_exists_any holds a column without a name at position 1 Missing name : Object jsonb_exists_any holds a column without a name at position 2 Missing name : Object jsonb_ge holds a column without a name at position 1 Missing name : Object jsonb_ge holds a column without a name at position 2 Missing name
: Object jsonb_gt holds a column without a name at position 1 Missing name : Object jsonb_gt holds a column without a name at position 2 Missing name : Object jsonb_hash holds a column without a name at position 1 Missing name : Object jsonb_in holds a column without a name at position 1 Missing name
: Object jsonb_le holds a column without a name at position 1 Missing name : Object jsonb_le holds a column without a name at position 2 Missing name : Object jsonb_lt holds a column without a name at position 1 Missing name : Object jsonb_lt holds a column without a name at position 2 Missing name
: Object jsonb_ne holds a column without a name at position 1 Missing name : Object jsonb_ne holds a column without a name at position 2

我需要排除 pg* 类型吗?

生成任务取自 JOOQ 样本:

task generate << {
  def writer = new StringWriter()
  def xml = new groovy.xml.MarkupBuilder(writer)
    .configuration("xmlns": "http://www.jooq.org/xsd/jooq-codegen-3.7.0.xsd") {
    jdbc() {
      driver("org.postgresql.Driver")
      url("jdbc:postgresql://localhost/pagila")
      user("xxx")
      password("xxx")
    }
    generator() {
      database() {
        name { mkp.yield( 'org.jooq.util.postgres.PostgresDatabase' ) }
        exclude("pg.*")
      }
      generate() {}
      target() {
        packageName("one.dbtest.db")
        directory("src")
      }
    }
  }

  //println writer.toString()

  org.jooq.util.GenerationTool.main(
    javax.xml.bind.JAXB.unmarshal(
        new StringReader(writer.toString()),
        org.jooq.util.jaxb.Configuration.class
    )
  )
}

更新:DB 是来自 http://pgfoundry.org/projects/dbsamples 的 pagila

最佳答案

对于 Postgres,您还必须指定输入模式,因此它是:

generator() {
  database() {
    name { mkp.yield( 'org.jooq.util.postgres.PostgresDatabase' ) }
    inputSchema("public")
  }
[..]

关于java - JOOQ 生成器 : Missing name,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33081039/

相关文章:

java - 在 Android 中使用 Script Engine Manager 评估中缀表达式

java - 从矩阵中获得最高总和的最佳方法(使用 Java 但算法是这里的问题)

sql - 如何在 PostgreSQL 9.3 中对两列进行条件求和

android - Gradle:如何在控制台中显示 androidTest 结果?

java - 如何使用 Gradle 添加默认 JVM 参数

java - 如何打印出 LinkedList 中的数据

java - 为什么从 Fish 运行时 Maven 使用错误的 JDK 版本?

java - 连接到 <主机名> :5432 refused

postgresql - 通过F#和Npgsql调用Postgresql中的存储过程

android - 错误:(1,0)插件太旧,请更新到更新版本,或设置ANDROID_DAILY_OVERRIDE “e71316b1598b09073ff04c4315280c3b0e755860”