Hello.
I have trouble with converting native SQL query to HQL. Query is something like follows:
select count(*)
, sum(select count(*) from employee e where e.company_id=c.id))
from company c where c.id = someID
First returned value is count of companies, second - amount of employees for specified company.
I.e. I have to get this two values for company with id=someID.
The trouble is hibernate doesn't support subselects in SELECT section, only in WHERE - by specification.
Actually I can:
1) use native query to run this through EntityManager
2) do the same dividing this "complex" query to two simpler SQL queries
But may be there are exist more convenient methods to realize initial query in HQL? - this is a question.
Thank you.