title: How to perform a non-polymorphic HQL query in Hibernate?
body: <p>I'm using Hibernate 3.1.1, and in particular, I'm using HQL queries.</p>
  
  <p>According to the <a href="http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html#queryhql-polymorphism" rel="noreferrer">documentation</a>, Hibernate's queries are polymorphic:</p>
  
  <blockquote>
    <p>A query like: <code>from Cat as cat</code> returns instances not only of <code>Cat</code>, but also of subclasses like <code>DomesticCat</code>.</p>
  </blockquote>
  
  <p><strong>How can I query for instances of Cat, but not of any of its subclasses?</strong></p>
  
  <p>I'd like to be able to do it without having to explicitly mention each subclass.</p>
  
  <p>I'm aware of the following options, and don't find them satisfactory:</p>
  
  <ol>
  <li>Manually filtering the instances after the query, OR:</li>
  <li>Manually adding a WHERE clause on the discriminator column.</li>
  </ol>
  
  <p>It would make sense for Hibernate to allow the user to decide whether a query should be polymorphic or not, but I can't find such an option.</p>
  
  <p>Thanks in advance!</p>