【发布时间】:2017-05-06 22:56:39
【问题描述】:
我有一个 MariaDB 数据库,我正在尝试在我的表 users 中插入一行。它有一个生成的id,我想在插入后得到它。我见过this,但它对我不起作用:
public Integer addNewUser(String name) {
Record record = context.insertInto(table("users"), field("name"))
.values(name)
.returning(field("id"))
.fetchOne();
return record.into(Integer.class);
}
已插入新行,但 record 始终为 null。我没有使用 JOOQ 代码生成。
【问题讨论】: