2
I have the following domains:
class Cliente {
static belongsTo = [empresa: Empresa]
static constraints = {
}
}
class Empresa {
/* aqui temos alguns atributos*/
}
By creating a new register of company class I can do well:
Empresa empresa = new Empresa(params)
empresa.save(flush:true)
but when trying to update that record:
Empresa empresa = Empresa.get(params.id)
/* ja tentei de todas essas maneiras */
empresa.properties = params
empresa = params
bindData(empresa,params)
bindData(empresa,params, exclude:[empresa.id]) // ja tentei com include em td tbm
bindData(empresa.properties, params)
I’ve also tried to place the property bindable: true
in constraints
more than nothing solved, sometimes error and others simply does not update the data, version of the grails: 2.4.2
Hello @alleen94, you must be talking about bindData (in your example is written dataBind...). And if you do the following: check exactly what is coming in your params and update manually, property by property, then save with flush and see if any exceptions will happen.
– cantoni
hi @Cantoni, so I ended up writing wrong I tested with bindData even, so currently I’m manually making property by property, but using databinding not right ;s
– tissei
OK @allen94. You took a look at the content of params to see if there is something there that is preventing the bindData from working?
– cantoni
So @Cantoni by what I search for has something to do with the Transient values of my domains, which default power cannot be bindables, I believe it is because of the relationship via belongsTo however I could not find any workaround and the only solution proposed is to set the attributes with the bindable:true Constraint did not solve my problem
– tissei