title: Can I use the JPA 2.0 CriteriaBuilder to fetch a list of non-entity objects?
body: <p>I asked a similar question to this, but I didn't provide good details, so I am re-asking the question with better details.</p>
  
  <p>I have 2 tables that look like this:</p>
  
  <pre><code>Table1
      A
      B
      C
      PK
  
  Table2
      D
      E
      F
      PK
  </code></pre>
  
  <p>These 2 tables have JPA entities associated with them as follows (I'm leaving out the annotations for brevity):</p>
  
  <pre><code>Entity1
      {
          String a;
          String b;
          String c;
          int PK;
      }
  Entity2
      {
          String d;
          String e;
          String f;
          int PK;
      }
  </code></pre>
  
  <p>I also have a simple POJO that I am using (not mapped to any table) as follows:</p>
  
  <pre><code>MyPOJO
      {
          String x;
          String y;
          String z;
      }
  </code></pre>
  
  <p>I currently am using JPA's native SQL functionality to return a result set of type List and the query looks something like this:</p>
  
  <pre><code>SELECT A as x, D as y, F as z from Table1, Table2 WHERE Table1.PK = Table2.PK
  </code></pre>
  
  <p>My question is, can I do this using CriteriaBuilder?  If so, how?  I am trying to stay away from native queries.  I am using OpenJPA, if that makes any difference.</p>