title: Query the database using discriminator values
body: <p>I am using single table inheritance strategy. I want to perform a search in the database by filtering it using the discriminator type. How am I to write a function in JPA to perform this operation.</p>
  
  <p>The normal way of defining methods using <code>findBy...</code> method does not produce results.</p>
  
  <p>Here is my parent class</p>
  
  <pre><code>@Entity
  @Inheritance(strategy=InheritanceType.SINGLE_TABLE)
  @DiscriminatorColumn(
          name="Leave_Type",
          discriminatorType=DiscriminatorType.STRING
          )
  public class LeaveQuota {
  // the fields and the required methods
  }
  </code></pre>
  
  <p>Here are the two child entities</p>
  
  <pre><code>@Entity
  @DiscriminatorValue("Annual")
  public class AnnualLeave extends LeaveQuota {
  // the fields and the required methods
  }
  
  @Entity
  @DiscriminatorValue("Casual")
  public class CasualLeave extends LeaveQuota {
  // the fields and the required methods
  }
  </code></pre>
  
  <p>I want to query the database by filtering the Annual leaves and Casual leaves separately. Which means when I search for annual leaves, all records in the discriminator column with value "annual" should be retrieved. How can I implement this. 
  Thanks in advance!</p>