【发布时间】:2016-07-07 10:50:07
【问题描述】:
我正在使用 grails 2.4.2,并且在我的控制器更新方法中有以下代码:
@Transactional
def update(ErtIncommingInvoice ertIncommingInvoiceInstance) {
if (ertIncommingInvoiceInstance == null) {
notFound()
return
}
// Concurrent-Update Test
if (ertIncommingInvoiceInstance.version != params.version as int) {
flash.warning = "Another user changed the record! (Concurrent Update Error)"
ertIncommingInvoiceInstance.errors.rejectValue("ertInfo", "concurrent.update.error")
respond ertIncommingInvoiceInstance.errors, view:'edit'
return
}
即使在这种情况下,检测到错误并设置错误对象并且方法流不执行
ertIncommingInvoiceInstance.save flush:true, failOnError: true
数据库中的数据已更改。 显示编辑视图,但不显示错误,只显示 Flash 消息。
我的推理错误在哪里?
【问题讨论】: