title: Is there such thing CASE expression in JPQL?
body: <p>Let say there is a table:</p>
  
  <pre><code>TableA:Field1, Field2, Field3
  </code></pre>
  
  <p>and associated JPA entity class</p>
  
  <pre><code>@Entity
  @Table(name="TableA")
  public class TableA{
    @Id
    @Column(name="Field1")
    private Long id;
  
    @Column(name="Field2")
    private Long field2;
  
    @Column(name="Field3")
    private Long field3;
  
    //... more associated getter and setter...
  }
  </code></pre>
  
  <p>Is there any way to construct a JPQL statement that loosely translated to this SQL, ie how to translated the case expression to JPQL?</p>
  
  <pre><code>select field1,
  case
    when field2 = 1 then 'One'
    when field2 = 2 then 'Two'
    else 'Other number'
  end,
  field3
  from tableA;
  </code></pre>