I seem to be experiencing the same issue, a few years later. Is this expected behavior? Here's an example SQL output:
Code:
select
sum(this_.amount) as y0_
from
public.Journal this_
where
this_.amount<>?
and this_.removed=?
and this_.draft=?
and this_.account_id=?
and this_.date>=?
and this_.currency_id=?
and this_.date<=?
My projection is quite simple: setProjection(sum("amount")); I'm not setting the ResultsTransformer.
When I call uniqueResult() I get a null value, which is strange - I know there are zero rows but I think hibernate should return 0 in that case, shouldn't it?