Hi Folks, I'm giving a quick look at GORM Data Ser...
# questions
g
Hi Folks, I'm giving a quick look at GORM Data Services, how can I
update
a whole domain object? I need to update a whole domain object passing a parameters Map. Something like this:
Copy code
@CurrentTenant
@Service(TPerson)
abstract class PersonService {
    protected abstract TPerson get(Serializable id)
    protected abstract TPerson getByName(String name)

    protected abstract Long count()
    protected abstract List<TPerson> list(Map args)
    protected abstract TPerson save(TPerson obj)

    // *** THIS IS NOT COMPILING ***
    protected abstract TPerson update(Serializable id, TPerson obj)

    protected abstract void delete(Serializable id)

    TPerson create(Map properties) {
        TPerson obj = new TPerson(properties)
        obj.validate()

        if (obj.hasErrors()) {
            return obj
        }

        return save(obj)
    }

    TPerson update(Serializable id, Map properties) {
        TPerson obj = get(id)
        obj.properties = properties
        obj.validate()

        if (obj.hasErrors()) {
            return obj
        }

        return update(id, obj)
    }

}