隐藏的列
适用于 ❌ 开源版 ✅ Express 版 ✅ 专业版 ✅ 企业版
jOOQ 的代码生成器可能会决定某列是隐藏的,在这种情况下,在各种 DML 语句中使用它可能会产生微妙的变化。特别是,该列默认将从所有投影、* 扩展、元数据查询中排除。但是,该列在生成的表中仍然可用,可供显式使用。
// UpdatableRecords don't contain the column anymore:
TRecord r1 = create.selectFrom(T).fetchOne();
r1.getInvisible(); // compilation error
// * expansions don't include the column anymore
Record r2 = create.select().from(T).fetchOne();
r2.get(T.INVISIBLE); // throws IllegalArgumentException, the column isn't available
Record r3 = create.select(asterisk()).from(T).fetchOne();
r3.get(T.INVISIBLE); // throws IllegalArgumentException, the column isn't available
// Meta data queries don't produce the column anymore:
assertNull(T.get(T.INVISIBLE));
// However, explicit usage is still possible
create.select(T.ID, T.INVISIBLE, T.VISIBLE)
.from(T)
.fetch();
数据是否隐藏的事实由DataType.hidden() 标志控制。
反馈
您对本页面有任何反馈吗?我们很乐意听到!