WITH Clause : Subquery Factoring using Hibernate

2.8k Views Asked by At
WITH dept_count AS (
  SELECT deptno, COUNT(*) AS dept_count
  FROM   emp
  GROUP BY deptno)
SELECT e.ename AS employee_name,
       dc.dept_count AS emp_dept_count
FROM   emp e,
       dept_count dc
WHERE  e.deptno = dc.deptno;

How can we map the data retrieved from above query (mean temporary table dept_count that got created due to the usage of WITH CLAUSE) to the following java class?

My Java class is having the following attributes: employee_name, emp_dept_count.

1

There are 1 best solutions below

2
On