Hibernate version:
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
I'm not really having trouble with Hibernate, so I didn't bother entering all the above information. I just need help converting the SQL below into an HQL query. I did some looking around on the web and through the manual and I couldn't find anything about case statements in Hibernate.
Code:
select
reportingName,
sum(totalNonMonetaryCount) as totalNonMonetaryCount,
sum(totalCreditCount),
sum(totalCreditAmount),
sum(totalDebitCount),
sum(totalDebitAmount)
from
(select
coalesce(reporting_Name,'someName') as reportingName,
(case when transaction_amount = 0 then 1 else 0 end) as totalNonMonetaryCount,
(case when is_credit = 'N' then 1 else 0 end) as totalCreditCount,
(case when is_credit = 'N' then transaction_Amount else 0 end) as totalCreditAmount,
(case when is_credit = 'Y' then 1 else 0 end) as totalDebitCount,
(case when is_credit = 'Y' then transaction_Amount else 0 end) as totalDebitAmount
from s_Transaction_e10 tran)
where reportingname is not null
group by reportingName
If you have any questions, or need any additional info, please feel free to ask.
-Brent