title: Using an @Embeddable entity in a JPA CriteriaQuery
body: <p>Let's say I have the following example entities - one is an <code>@Embeddable</code>, embedded inside another <code>@Entity</code>:</p>
  
  <pre><code>@Embeddable
  public class ContactInfoEntity {
  
      @Column
      private String phone;
  
      @Column
      private String zipCode;
  }
  
  @Entity
  @Table(name = "EMPLOYEE")
  public class EmployeeEntity {
  
      @Id
      @Column(name = "EMPLOYEE_ID")
      private Long employeeId;
  
      @Embedded
      @AttributeOverrides({
          @AttributeOverride(name = "phone",
                             column = @Column(name = "EMPLOYEE_PHONE")),
          @AttributeOverride(name = "zipCode",
                             column = @Column(name = "EMPLOYEE_ZIP_CODE"))
      })
      private ContactInfoEntity employeeContactInfo;
  }
  </code></pre>
  
  <p>The meta-model classes generated by the openjpa-maven-plugin include only an <code>employeeContactInfo</code> variable, not the <code>@AttributeOverride</code> columns.</p>
  
  <p>Now suppose I want to do this:</p>
  
  <blockquote>
    <p>Select the <code>EMPLOYEE_ID</code> and <code>EMPLOYEE_PHONE</code> where the <code>EMPLOYEE_ZIP_CODE</code> is equal to "123456"</p>
  </blockquote>
  
  <p>How do I create this as a <code>CriteriaQuery</code>?</p>
  
  <pre><code>CriteriaBuilder cb = entityManager.getCriteriaBuilder();
  
  CriteriaQuery&lt;String&gt; qDef = cb.createQuery(String.class);
  Root&lt;EmployeeEntity&gt; e = qDef.from(EmployeeEntity.class);
  qDef.select(e.get(EmployeeEntity_.employeeId),
              e.get(????))
      .where(cb.equal(e.get(????), "123456"));
  
  return entityManager.createQuery(qDef).getResultList();
  </code></pre>