【发布时间】:2017-01-08 14:44:09
【问题描述】:
我正在尝试使用 JOOQ 调用管理功能 pg_catalog.pg_advisory_unlock。我可以通过在我的 gradle 构建文件中生成该函数的模型:
schemata {
schema {
inputSchema = "public"
}
schema {
inputSchema = "pg_catalog"
}
includes = "public.*|pg_catalog.pg_advisory_lock"
}
文件pg_catalog>Routines.java 有一个方法 public static void pgAdvisoryLock1(Configuration configuration, Long __1) 我这样称呼它:
Connection connection = DatabaseService.getInstance().getConnection("sampleUser");
Settings settings = new Settings()
.withRenderMapping(new RenderMapping()
.withSchemata(
new MappedSchema().withInput("shard_0")
.withOutput("shard_1")));
DSLContext create = DSL.using(connection, settings);
Long param = 1l;
pgAdvisoryLock1(create.configuration(), param);
我得到错误:
Exception in thread "main" org.jooq.exception.DataAccessException: SQL [select * from "pg_catalog"."pg_advisory_lock"("_1" := ?)]; ERROR: function pg_catalog.pg_advisory_lock(_1 => bigint) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
不胜感激。谢谢!
编辑:再想一想,我想我记得在某处读到 JOOQ 在 postgres 函数中存在非命名参数的问题。想知道这是否与此有关。由于它是一个管理内置函数,我无法将非命名参数更改为命名参数。我正在使用 3.6.2 版的 JOOQ(主要是因为我正在使用这个 gradle 插件(https://github.com/etiennestuder/gradle-jooq-plugin),我认为它正在使用该版本的 JOOQ。不确定新版本的 JOOQ 是否已修复。
【问题讨论】: