title: Grails: Search with inheritance in domain class
body: <p>I have this two domain models in my Grails application</p>
  
  <pre><code>class Pet {
      String prop1
      String prop2
  }
  </code></pre>
  
  <p>and this </p>
  
  <pre><code>class Cat extends Pet {
      String prop3
      String prop4
  }
  </code></pre>
  
  <p>Now, in my app, I have many classes that is extending <code>Pets</code> and I want to search <code>Pet</code> with criteria, specifying some properties that cannot exists in other pets.</p>
  
  <p>How can I make possible this operation? If I try to make a search, when a result not contains the property, raise an exception.</p>