新版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
相关产品推荐
相关产品推荐

