Problems updating registry data with dataBinding on Grails

Asked

Viewed 138 times

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.

  • 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

  • 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?

  • 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

1 answer

0


  • Hello @alleen94, cool serial if you explain here how it was solved. Making a summary of the thread found in Grails Brasil.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.