【发布时间】:2021-08-01 04:16:36
【问题描述】:
我正在尝试在我的数据库中保存(插入)一条新记录,但我得到的只是错误:Cannot update entity because entity id is not set in the entity.
我目前在做什么:
return this.connection.transaction(entityManager => {
return entityManager.save(MyEntity, {/* payload without id */});
});
这是我的代码库中唯一发生此问题的地方(交易与否)
【问题讨论】:
-
鉴于“它自行解决”的说法,这不是一个很好的问题。 github.com/typeorm/typeorm/issues/7643
标签: mysql node.js typescript nestjs typeorm