Department(dno,dname) Employee(eno,salary and Object of Department dept) Project(pno and Object of Department dept)
In hibernate I have write a query as :
SELECT d.dname,a.s,b.c FROM Department d, (SELECT e.dept.dname dn,sum(salary) s FROM Employee e group by dn) a, (SELECT p.dept.dname dnm, count(*) s FROM Project p group by dnm) b Where d.dname = a.dn and a.dn = b.dnm
But Hibernate gives error in From clause where "(" starts. I think Hibernate does not support Subquery in From clause.
Individually Employee group by and Project group by is alright in Hibernate.
Help me to Solve above Problem
Joined: Feb 18, 2003
Review using "Criteria" objects in your query. This is how I got around doing a subquery across tables.