title: How do you select a list of objects with composite keys?
body: <p>Currently using Eclipselink JPA 2.4.2 and have a bunch of objects stored in the database using a composite key via the @IdClass method, i.e:</p>
  
  <pre><code>@Entity
  @IdClass(ThingsPK.class)
  public class MyBunchOfThings {
  
     @Id
     @GeneratedValue(generator="ID_SEQ")
     @SequenceGenerator(name="ID_SEQ")
     private Integer id;
  
     @Id
     private Date timestamp;
  
     ...
  
  }
  
  public class ThingsPK {
  
     private Integer id;
  
     private Date timestamp;
  
  }
  </code></pre>
  
  <p>If I need to select a few of these things via a select in clause, how do I do this via JPQL with the composite primary key?</p>
  
  <p>e.g. </p>
  
  <pre><code>List&lt;ThingsPK&gt; keyList = ...
  TypedQuery&lt;MyBunchOfThings&gt; query = em.createQuery("SELECT t FROM MyBunchOfThings t WHERE t.??? IN :keyList", MyBunchOfThings.class);
  query.setParameter("keyList", keyList);
  List&lt;MyBunchOfThings&gt; foundThings = query.getResultList();
  </code></pre>