Hi, I have to implement a SQL query (with case when stmt) in HQL. HQL documentation says that HQL supports the case when statement. But when i converted the query to HQL, it gives me errors ..
Here is the query: select prod, case when length(prod.category) > 0 then prod.category when length (prod.iTax.icCategoryId) > 0 then (select pt.portalPcategoryName from Products p join p.iTax ic join ic.pim pim join pim.pT pt where pt.portals.portalId = ortalId and p.productId = prod.productId) end as category from Products prod where prod.clients.feedId = :feedId and prod.deadUrlLink = :bln1 and prod.active = :bln2
========================================================== The exception i receieve is : org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: query ==========================================================
This query works correctly in postgresql. Can someone point out where I am going wrong. Thanks a lot.
Joined: Jul 11, 2005
Or does anyone know how to use the CaseFragment stmt (which I am assuming is for Case when stmt) using the criteria API ?