QL - , , .
, , DepartmentEmployeeCount, :
public DepartmentEmployeeCount(String departmentName, Integer employeeCount)
QL - :
SELECT NEW DepartmentEmployeeCount(D.DEPARTMENT_NAME, count(E.id)) from Department D left join D.employees E GROUP BY D.DEPARTMENT_NAME
, (*), .
, DepartmentEmployeeCount, NEW, :
SELECT D.DEPARTMENT_NAME, count(E.id)
a List<Object[]>, 2 , _ count.
, employeeCount, - 2 . , ( ).
,
SELECT D from Department D
List<Department>
:
SELECT D.DEPARTMENT_ID, count(E.id) from Department D left join D.employees E GROUP BY D.DEPARTMENT_ID
List<Object[]> DEPARTMENT_ID .
.
( , , , Hibernate).