You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

新版jOOQ Gradle Plugin处理自引用关联存在异常

升级jOOQ Gradle Plugin 3.19.0遇自引用实体警告问题

切换至新版jOOQ Gradle Plugin 3.19.0时,包含自引用字段的实体出现警告提示,使用旧版nu.studer.jooq插件时可正常运行。

引发问题的表结构

CREATE TABLE IF NOT EXISTS nodes (
    id UUID NOT NULL /* [jooq ignore start] */ DEFAULT uuid_generate_v4() /* [jooq ignore stop] */,
    name VARCHAR(50),
    description VARCHAR(255),
    parent_id UUID
);
ALTER TABLE nodes ADD CONSTRAINT nodes_pk PRIMARY KEY (id);
ALTER TABLE nodes ADD CONSTRAINT nodes_parent_fk FOREIGN KEY (parent_id) REFERENCES nodes(id) /* [jooq ignore start] */ON UPDATE CASCADE/* [jooq ignore stop] */;

执行命令及警告信息

执行命令:

./gradlew clean jooqCodegenMain

出现如下警告:

Ambiguous key name       : The database object nodes_parent_fk generates an inbound key method name nodes which conflicts with the previously generated outbound key method name. Use a 
custom generator strategy to disambiguate the types. More information here:
 - https://www.jooq.org/doc/latest/manual/code-generation/codegen-generatorstrategy/
 - https://www.jooq.org/doc/latest/manual/code-generation/codegen-matcherstrategy/

更新说明

仅出现上述警告,最终生成的实体类可正常工作。


内容的提问来源于stack exchange,提问作者Hantsy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.03 16:32:15