Grails数据绑定:对domainInstance.properties=params没有影响

Grails数据绑定:对domainInstance.properties=params没有影响,grails,data-binding,Grails,Data Binding,我正在使用Grails2.2.2。 我有一个名为“Table”的域和一个自动生成的控制器TableController。问题是,“更新”操作没有效果 def update = { def tableInstance = Table.get(params.id) println params.definition if (tableInstance) { if (params.version) { def version = para

我正在使用Grails2.2.2。 我有一个名为“Table”的域和一个自动生成的控制器TableController。问题是,“更新”操作没有效果

def update = {
    def tableInstance = Table.get(params.id)
    println params.definition
    if (tableInstance) {
        if (params.version) {
            def version = params.version.toLong()
            if (tableInstance.version > version) {

                tableInstance.errors.rejectValue("version", "default.optimistic.locking.failure", [message(code: 'table.label', default: 'Table')] as Object[], "Another user has updated this Table while you were editing")
                render(view: "edit", model: [tableInstance: tableInstance])
                return
            }
        }
        tableInstance.properties = params
        println tableInstance.definition
        if (!tableInstance.hasErrors() && tableInstance.save(flush: true)) {
            flash.message = "${message(code: 'default.updated.message', args: [message(code: 'table.label', default: 'Table'), tableInstance.id])}"
            redirect(action: "show", id: tableInstance.id)
        }
        else {
            render(view: "edit", model: [tableInstance: tableInstance])
        }
    }
    else {
        flash.message = "${message(code: 'default.not.found.message', args: [message(code: 'table.label', default: 'Table'), params.id])}"
        redirect(action: "list")
    }
}
第一个println有输出:“newValue” 第二个pringln有输出:“oldValue”

很明显,以下行中的数据绑定不起作用:

tableInstance.properties = params
在GrailsVerions1.3.7中,它按预期工作


欢迎提出任何建议

原因是该属性是瞬态的。在Grails2.x中,由于安全问题,暂时属性不再绑定。

原因是该属性是瞬态的。在Grails2.x中,由于安全问题,暂时属性不再绑定。