title: Create criteria using Criteria Builder to query fields of concrete child class of abstract parent class
body: <p>I working on a requirement where user enters a text and I need to show matching data on screen.</p>
  
  <p>I am using EclipseLink as JPA provider.</p>
  
  <p>Following is the code</p>
  
  <pre><code>@Entity
  @Table(name="customer")
  public class Customer{
       private List&lt;Address&gt; addresses = new ArrayList&lt;Address&gt;();
   //other code
  }
  
  @Entity
  @Inheritance(strategy = InheritanceType.SINGLE_TABLE)
  @DiscriminatorColumn(name = "type")
  @Table(name="address")
  public abstract class Address{
  private String name;
  
  }
  
  @Entity
  public class PostalAddress extends Address{
  private Contact number;
  }
  
  public class Contact{
    private String number;
    public Contact(String number){
    this.number = number;
    }
  }    
  </code></pre>
  
  <p>In DataBase I have table 'address' in which I have columns 'name' and 'number'.</p>
  
  <p>I want to create a Predicate using CriteriaBuilder to search a specific value in table.</p>
  
  <p>I have tried using </p>
  
  <pre><code>criteriabuiler.like(criteriabuiler.lower(root.join("addresses", JoinType.LEFT).&lt;String&gt;get("number")), searchString));
  </code></pre>
  
  <p>But it gives exception as </p>
  
  <pre><code>The attribute [msisdn] from the managed type [EntityTypeImpl@27575562:Address] is not present.
  </code></pre>
  
  <p>Can you please suggest a way to implement this thing?</p>