我想使用 dsl 上下文插入超过 22 个字段。
val dslContext: DSLContext = DSL.using(
DriverManager.getConnection("jdbc:postgresql://localhost:5432/postgres?user=postgres&password=postgres"),
SQLDialect.POSTGRES,
jooqSettings)
dslContext
.insertInto(
table,
table.field1,
table.field2,
table.field3,
table.field4,
table.field5,
table.field6,
table.field7,
table.field8,
table.field9,
table.field10,
)
.values(
fields(0),
fields(1),
fields(2),
fields(3),
fields(4),
fields(5),
fields(6),
fields(7),
fields(8),
fields(9)
)
.execute()
我想插入超过 22 个字段,但构造函数最多允许 22 个字段。可以插入22个字段吗?
最佳答案
insertInto 方法可以接受任意数量的字段(它具有最多 22 个字段的特定重载和一个更通用的 vararg 版本,可以接受 23 个或更多字段)。因此,只需在您展示的示例中继续添加您的字段,它应该可以正常工作。
关于java - 使用 jooq dsl 插入超过 22 个字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62327698/