title: Grails named query
body: <p>I have two domain classes, Alpha and Beta.</p>
  
  <pre><code>class Beta{
    String betaName
    int age
  }
  
  class Alpha{
    String name
    static belongsTo=[creator:Beta]
  
    static namedQueries = {
      alphaByUser{ param -&gt;
        eq creator.betName,param.betaName
  }
      alphaByAge {param -&gt; 
        eq creator.age,param 
      }
    }
  }
  </code></pre>
  
  <p>Now when I call for example Alpha.alphaByUser(betaUser).list() I keep getting things like:</p>
  
  <pre><code>java.lang.NoSuchMethodException: Unknown property 'create' on class 'class org.codehaus.groovy.grails.commons.DefaultGrailsDomainClass'
  </code></pre>
  
  <p>Or </p>
  
  <pre><code>object is not an instance of declaring class
  </code></pre>
  
  <p>I just can't seem to get past it...</p>
  
  <p>Any suggestions?</p>