title: GORM - Update object without retrieving it first
body: <p>I'd like to be able to update a previously persisted object for which I have an id without having to retrieve it first.  The main thing that I'm trying to avoid is having to copy multiple values into the object's fields when that object has been retrieved from the database.  I have these values in a map with keys corresponding to the field names so it's trivial to create the object via a constructor with the map as an argument.  Unfortunately, an object created this way results in a new database record when saved even though the id field is set to that of an existing record.  </p>
  
  <p>I'm currently using a slight variation on one of the examples shown <a href="https://stackoverflow.com/questions/9072307/copy-groovy-class-properties">here</a> for copying Groovy class properties but it's not a very elegant solution for multiple reasons.</p>
  
  <p>Basically I'd like to be able to do something like this:</p>
  
  <pre><code>class Foo {
      int a
      String b
  }
  
  def data = [id: 99, a: 11, b: "bar"]    //99 is the id of an existing record
  def foo = new Foo(data)
  foo.update()    //or some other comparable persistence mechanism
  </code></pre>
  
  <p>Thanks</p>