Is there any way to do the following in HQL:
SELECT
case when flag = true then SUM(col1) else SUM(col2)
FROM
myTable
Below you can find a working query (hibernate on postgresql) that uses 2 case statements to replace a boolean value with the corresponding textual representation.
SELECT CASE ps.open WHEN true THEN 'OPEN' else 'CLOSED' END, CASE ps.full WHEN true THEN 'FULL' else 'FREE' END, ps.availableCapacity FROM ParkingState as ps