title: How to populate DTO class string fields using JPA CriteriaQuery on Entity having enum fields?
body: <p>I'm using JPA Criteria API, and in my query multiselect I want to retrieve an enum attribute, and not the enum itself.</p>
  
  <p>This is my query :</p>
  
  <pre><code>final CriteriaQuery&lt;MyClassDTO&gt; query = builder.createQuery(MyClassDTO.class);
  </code></pre>
  
  <p>in <code>MyClassDTO</code> I have 4 fields as following:</p>
  
  <pre><code>private String icon;
  private String provenance;
  private int sizeX;
  private int sizeY;
  </code></pre>
  
  <p>And the path I'm retrieving data from is :</p>
  
  <pre><code>final Root&lt;MyClass&gt; from = query.from(MyClass.class);
  </code></pre>
  
  <p><code>MyClass</code> has 3 fields :</p>
  
  <pre><code>@Column
  @Enumerated(EnumType.STRING)
  private EnumTileIcon enumTileIcon;
  
  @Column
  @Enumerated(EnumType.STRING)
  private EnumProvenance enumProvenance;
  
  @Column
  @Enumerated(EnumType.STRING)
  private EnumSize enumSize;
  </code></pre>
  
  <p>What I want to do is to populate the <code>MyClassDTO</code> using the <code>query.multiselect</code>, something like this :</p>
  
  <pre><code>query.multiselect(
      from.get(MyClass_.enumTileIcon.toString()),
      from.get(MyClass_.enumProvenance.name()),
      from.get(MyClass_.enumSize.getWidth()),
      from.get(MyClass_.enumSize.getHeight())
  );
  </code></pre>
  
  <p>How can I solve this ?</p>