mysqlspringhibernatehql

How to write a sum() with a combination of case in Hibernate?


Here is my code that uses Hibernate.

I'm expecting some thing like this

SUM( CASE WHEN model.voter.age 
            between '"+18+"' and '"+25+"' 
            THEN 1 ELSE 0 END) as 18ageCount

org.springframework.orm.hibernate3.HibernateQueryException: expecting IDENT, found '18' near line 1, column 325

I tried with different combinations, but it isn't not working.


Solution

  • just eroor because of 18ageCount this one only and i rewrite it