title: Can I call GORM "find" methods on an object instead of the class?
body: <p>I'm trying to take advantage of the fact that groovy is more dynamic than java.
  I'd like to have a block of code that does</p>
  
  <pre><code>TypeA type = //do something to build an object
  TypeA dbType = TypeA.findBySomethingAndSomething(something, somethingelse)
  if(dbType != null)
     type.id = dbType.id
  type.save()
  </code></pre>
  
  <p>but that can work for multiple objects that support the same findBySomethingAndSomething method.</p>
  
  <p>Is it possible to say</p>
  
  <pre><code>def type = //do something to build an object
  def dbType = type.findBySomethingAndSomething(type.identifier, type.otheridentifier)
  if(dbType != null)
     type.id = dbType.id
  type.save()
  </code></pre>
  
  <p>Is there a "better" way to accomplish this?
  I'm trying to avoid a large switch statement or if / else series that does essentially the same thing for each type.</p>