java-JOOQ生成器:缺少名称
作者:互联网
我正在尝试使用Postgres和Gradle设置JOOQ.
每当我运行generate任务时,我都会得到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开始的历史记录
解决方法:
对于Postgres,您还必须指定输入模式,因此为:
generator() {
database() {
name { mkp.yield( 'org.jooq.util.postgres.PostgresDatabase' ) }
inputSchema("public")
}
[..]
标签:jooq,postgresql,gradle,java 来源: https://codeday.me/bug/20191119/2037397.html