title: Hibernate Polymorphic HQL SELECT statement
body: <p>I'm Using Hibernate annotation to persist my classes.
  Currently I'm using the following strategy to map the classes</p>
  
  <p>I have an abstract class which is the Parent class, and I have two sub-classes which inherit from it
  Mother, Father.</p>
  
  <p>I mapped it like that:</p>
  
  <pre><code>@MappedSuperclass
  public abstract class Parent {
  
  private int age;
  private String name;
  ...
  }
  </code></pre>
  
  <p>And the two other classes are declared like this:</p>
  
  <pre><code>@Entity
  public Class Father extends Parent {
  
  private boolean haveMustash;
  ...
  }
  </code></pre>
  
  <p>So basically the scenario is "Table per Class".</p>
  
  <p>Now I want to create an Hibernate HQL statement that will update the age of a parent, regardless of it's kind (mother,father). the parent will be looked up using the name column, which is unique in both of the tables. but I don't know just looking at the name if it is Mother or Father.
  How can I create a HQL statement that will look in both of the tables, and return the right entity to update ?</p>
  
  <p>I thought about something like this: (but I don't have an idea if it is even possible)</p>
  
  <pre><code>Parent parent = hibernateTemplate.find("from Mother,Father where name="
          + name);
  </code></pre>