Hi,
I was wondering what is the best way to handle a request for an update on an existing entity (e.g. a Person) when receiving the request as a webservice request.
In my project I have a Person domain class and I would like to expose CRUD operations as webservice operation through the CXF plugin. So I make a PersonService, and expose the methods with
static expose = ['cxfjax']
Then I have the update method:
@WebResult(name = "person")
@WebMethod(operationName = "update")
Person update(@WebParam(name="person")Person person) {
println "Updating $person"
return person.save()
}
In the service I get a fine Person object, but even if it has an id of an existing person, a new person is created, and the id is changed to reflect this.
SO... how do I get the person I receive "merged" into the Hibernate session, so that Grails will recognise it as an existing Person?
Kind regards,
Christian