[英]What are the consequences of disabling relation generation in the JOOQ generator?
I can disable identity, foreign key, and unique key generation in the JOOQ generator by setting the following configuration options : 我可以通过设置以下配置选项来禁用JOOQ生成器中的标识,外键和唯一键生成:
<generate>
<!-- Primary key / foreign key relations should be generated and used.
This is a prerequisite for various advanced features.
Defaults to true -->
<relations>false</relations>
Despite the FK/UK information not being present in the meta-model, what exactly are the consequences of disabling this generation? 尽管元模型中没有FK / UK信息,但是禁用这一代人的后果到底是什么? Which features of JOOQ itself depend upon this information?
JOOQ本身的哪些功能取决于此信息?
Essentially, most of the features documented in the manual's section about CRUD will be unavailable to you: 本质上,您将无法使用手册中有关CRUD的部分中记录的大多数功能:
http://www.jooq.org/doc/latest/manual/sql-execution/crud-with-updatablerecords/ http://www.jooq.org/doc/latest/manual/sql-execution/crud-with-updatablerecords/
Without knowledge about primary keys, there are no UpdatableRecord
. 没有主键知识,就没有
UpdatableRecord
。 Ie, you will not be able to write things like: 即,您将无法编写以下内容:
// This works:
MyTableRecord record =
DSL.using(configuration)
.selectFrom(MY_TABLE)
.where(MY_TABLE.ID.eq(1))
.fetchOne();
// These won't work:
record.store();
record.update();
record.refresh();
record.delete();
// This will still work:
record.insert();
Foreign key information is currently used in only a few places in jOOQ, among others, navigation methods : 目前,jOOQ中仅在少数几个地方使用外键信息,其中包括导航方法 :
BookRecord book = DSL.using(configuration)
.selectFrom(BOOK).where(BOOK.ID.eq(1)).fetchOne();
// This won't work
AuthorRecord author = book.fetchParent(FK_BOOK_AUTHOR);
There are also plans to enhance the code generator to generate such navigation methods ( #4210 ), which means that the following won't work: 还计划增强代码生成器以生成此类导航方法( #4210 ),这意味着以下操作无效:
// This won't work
AuthorRecord author = book.fetchFkBookAuthor();
Or, the synthetic JOIN ON KEY
clause: 或者,合成的
JOIN ON KEY
子句:
DSL.using(configuration)
.select()
.from(AUTHOR)
.join(BOOK).onKey()
.fetch();
There will be other features depending on the availability of constraint information in the future, but ordinary SQL statements aren't affected. 将来还会有其他功能,具体取决于约束信息的可用性,但是普通的SQL语句不受影响。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.