hibernate - setting the hql or criteria for the below sql with decode condition in sql -


i have below following pojo , have generate hql or criteria following sql..

class took {  private string aaa;  private string bbb = "";  private string ccc;   public took(string aaa, string bbb ,string ccc)     {     this.aaa = aaa;     this.bbb = bbb;     this.ccc = ccc;          } }  select aaa,decode(bbb_b,'y','act','rev') perm,ccc_c took 

i have generated hql shown below , issue query shown in above sql query using decode on column bbb_b , setting value plus column perm created dynamically in query how adjust in hql please advise.

list<took> b1 = session.createquery("select new com.abc.def.took(aaa, bbb,ccc) took").list(); 

please advise crtiteria equivalent this

you can add annotation bbb property (if use annotations).

@formula("decode(bbb_b,'y','act','rev')") public string getbbb() {    return bbb; } 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -