title: Grails domain class query - how can I find by fields that link to another domain class?
body: <p>Lets say I have two domain classes:</p>
  
  <pre><code>class User {
    String name
    Role role
  }
  
  class Role {
    String name
    static belongsTo = [user: User]
  }
  </code></pre>
  
  <p>and I create some records:</p>
  
  <pre><code>def r1 = new Role(name: "role1").save()
  def r2 = new Role(name: "role2").save()
  new User(name: "user1", role: r1).save()
  new User(name: "user2", role: r2).save()
  new User(name: "user3", role: r1).save()
  </code></pre>
  
  <p>How can I now select my users by role? I would expect to be able to do one of the following:</p>
  
  <pre><code>def role = Role.findByName("role1"); //returns a Role with [ id:1 name:"role1" ]
  User.findAllByRole(role) //returns null
  User.findAllByRole(new Role(name: "role1")) //returns null
  User.findAllByRole(role.id) //returns null
  User.findAllByRole(id: role.id) //returns null
  </code></pre>
  
  <p>Is it possible for a domain class to find other associated domain classes using the dynamic find* methods? I can do it using namedQueries, but id rather not because I dont want to have to write them out for <em>every</em> relationship I have between domain classes</p>