Case Statement In Hql Or Criteria
derived from this question, is it possible to use HQL or Criteria for the following SQL statement: SELECT e.type, count(e), count(d), count (case when gender = 'mal
Solution 1:
Well, it seems, case statements are supported:
http://docs.jboss.org/hibernate/core/3.5/reference/en/html/queryhql.html
They just don't seem to work within count(). An alternative would be using sum(case when... then 1 else 0 end) instead
Post a Comment for "Case Statement In Hql Or Criteria"