[英]JOOQ generator: Missing name
I'm trying to setup JOOQ with Postgres and Gradle.我正在尝试使用 Postgres 和 Gradle 设置 JOOQ。
Whenever I run the generate task I get ~ 20 Ambiguous type names
:每当我运行生成任务时,我都会得到 ~ 20 个
Ambiguous type names
:
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.
类型名称不明确: object pg_catalog.generate_series 生成一个类型 one.dbtest.db.pg_catalog.tables.GenerateSeries,它与某些操作系统上的现有类型 one.dbtest.db.pg_catalog.tables.GenerateSeries 冲突。 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.
类型名称不明确: object pg_catalog.generate_series 生成一个类型 one.dbtest.db.pg_catalog.tables.GenerateSeries,它与某些操作系统上的现有类型 one.dbtest.db.pg_catalog.tables.GenerateSeries 冲突。 Use a custom generator strategy to disambiguate the types.
使用自定义生成器策略来消除类型歧义。
and hundreds of these:还有数百个:
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
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在 position 没有名字 1 缺少名字:Object jsonb_ge 拥有一个在 position 没有名字的列 2 缺少名字
: 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_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姓名在 position 1 缺少姓名
: 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_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姓名在 position 2 缺少姓名
: 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: Object jsonb_ne 在 position 拥有一个没有名字的列 1 缺少名字: Object jsonb_ne 在 position 拥有一个没有名字的列 2
Do I need to exclude the pg* types?我需要排除 pg* 类型吗?
The generate task is taken from the JOOQ samples:生成任务取自 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
)
)
}
Updated: DB is pagila from http://pgfoundry.org/projects/dbsamples更新:DB 是来自http://pgfoundry.org/projects/dbsamples 的 pagila
For Postgres you also have to specify the input schema, so it's: 对于Postgres,您还必须指定输入模式,因此它是:
generator() {
database() {
name { mkp.yield( 'org.jooq.util.postgres.PostgresDatabase' ) }
inputSchema("public")
}
[..]
Add <inputSchema>public</inputSchema>
in <database>
block in your pom.xml file if you have added <name>org.jooq.meta.postgres.PostgresDatabase</name>
in generator.如果在生成器中添加了
<name>org.jooq.meta.postgres.PostgresDatabase</name>
,则在 pom.xml 文件的<database>
块中添加 <inputSchema <inputSchema>public</inputSchema>
public</inputSchema> 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.