Question regarding that HQL workaround. Does it currently work in the latest hibernate release? I am getting a syntax exception because coalesce cannot be inside a count.