I've got a fairly simple Grails app against a DB2 database. Everything works fine except when I try to update a record. show() and edit() are able to find the record , but the update fails saying that it cannot be located. Here's the edit:
def edit()
{
def flatAdjustmentInstance = FlatAdjustment.get( new FlatAdjustment(compPayeeID: params["compPayeeID"], effectiveQuarterBeginDate: params["effectiveQuarterBeginDate"]) ) //here are your inbound params
if(!flatAdjustmentInstance)
{
flash.message = "MRI Modifier Record not found with ${params}"
redirect(action:"list")
}
else
{
return [ flatAdjustmentInstance: flatAdjustmentInstance]
}
}
Now the update()
def flatAdjustmentInstance = FlatAdjustment.get( new FlatAdjustment(compPayeeID: params["compPayeeID"], effectiveQuarterBeginDate: params["effectiveQuarterBeginDate"]) ) //here are your inbound params
//def flatAdjustmentInstance = new FlatAdjustment(compPayeeID: params["compPayeeID"], effectiveQuarterBeginDate: params["effectiveQuarterBeginDate"])
if (!flatAdjustmentInstance)
{
flash.message = message(code: 'default.not.found.message', args: [message(code: 'flatAdjustment.label', default: 'FlatAdjustment'), params])
redirect(action: "list")
return
}
As I said, all controller methods/closures create the instance of the domain object in the same way and all work correctly except for update(). Any ideas?