可用版本: Dev (3.21) | 最新版 (3.20) | 3.19 | 3.18 | 3.17 | 3.16 | 3.15 | 3.14 | 3.13 | 3.12 | 3.11

自动附加记录

适用于 ✅ 开源版   ✅ 专业版   ✅ 企业版

默认情况下,通过 jOOQ 获取的所有记录都会“附加”到创建它们的 配置。这允许使用诸如 可更新记录之类的功能,如此处所示

AuthorRecord author =
DSL.using(configuration) // This configuration will be attached to any record produced by the below query.
   .selectFrom(AUTHOR)
   .where(AUTHOR.ID.eq(1))
   .fetchOne();

author.setLastName("Smith");
author.store(); // This store call operates on the "attached" configuration.

在某些情况下(例如,序列化记录时),可能不希望将创建记录的 Configuration 附加到该记录。 这可以通过 attachRecords 设置来实现

示例配置

Settings settings = new Settings()
    .withAttachRecords(false); // Defaults to true

反馈

您对此页面有任何反馈吗? 我们很乐意听到您的声音!

The jOOQ Logo