title: Adding a Projection to a List in Hibernate
body: <p>I have a @Entity called Order in this I have a field or a member variable called orderEmails as show below.</p>
  
  <pre><code>@Entity
  @Table(name = "order")
  public class Order {
  
  @Id
  @Column(name = "order_int")
  private Long id;
  
  @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
  @JoinColumn(name = "order_int", insertable = false, updatable = false)
  private List&lt;OrderEmail&gt; orderEmails;
  </code></pre>
  
  <p>...
  }</p>
  
  <p>I am trying to create Projections on this Order , meaning I want to select some specific columns from the Order entity and a column from the OrderEmail entity</p>
  
  <p>But, when I create a projection on the orderEmails field. I don't get the complete list of emails. Which is what I want. Here is the code that I am trying</p>
  
  <pre><code>ProjectionList columnList = Projections.projectionList();
  ...
  columnList.add(Projections.property("id").as("id"));
  ...
  columnList.add(Projections.property("orderemails.EmailAddress").as("email"));
  </code></pre>
  
  <p>Note, I have also tried
  columnList.add(Projections.property("orderemails").as("email"));
  and changed the email (in as) to be a List, but didn't help</p>
  
  <p>Is it possible to create a projection on a List in Hibernate ?</p>