Pre Exam Test Practice (SSC | Banking | IAS | GATE | State Level | CLAT | Railways | Insurance | Teaching Exams | NDA | Defence | IES |State Exam )

Organizational Research By

Surprising Reserch Topic

is there such thing case expression in jpql

is there such thing case expression in jpql  using -'java,oracle,orm,jpa'

Let say there is a table:

TableA:Field1, Field2, Field3

and associated JPA entity class

public class TableA{
  private Long id;

  private Long field2;

  private Long field3;

  //... more associated getter and setter...

Is there any way to construct a JPQL statement that loosely translated to this SQL, ie how to translated the case expression to JPQL?

select field1,
  when field2 = 1 then 'One'
  when field2 = 2 then 'Two'
  else 'Other number'
from tableA;


asked Oct 3, 2015 by android_master
0 votes

Related Hot Questions

Government Jobs Opening