title: Joins in Grails Criteria
body: <p>I'm trying to write a criteria query in grails, for the following domains:</p>
  
  <pre><code>class Data {
      Long createdById // this is user id
      // other fields
  }
  class User {
     Company company
     // other fields
  }
  </code></pre>
  
  <p>Now data, as the name suggest stores some data. It is not directly related to User but has a field createdById which is the id of User. <br/>(I cannot give direct reference of User in Data because these belongs to different projects, where Data is from a custom reusable plugin.)</p>
  
  <p>Now I want to write criteria on Data and list all records where it was created by users of a given company. that is <code>data.id == User.id and user.company == givenCompany</code></p>