是否可以使用 Multiselect 将查询结果用作我的最终查询结果集中的列?
例如:
查询一:
select EMPLOYEE_NAME name, (Query 2) TOTAL_WORKING_DAYS FROM EMPLOYEE;
查询 2:
select COUNT(*) from WORKING_DAYS;
我正在尝试这个:
CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
CriteriaQuery<Tuple> criteriaQuery = criteriaBuilder.createTupleQuery();
Root<Employee> employeeRoot = criteriaQuery.from(Employee.class);
Path<String> employeeName = employeeRoot .get(Employee_.employeeName);
criteriaQuery.multiselect(employeeName , ??<This is the place where I am confused> );
List<Tuple> results = em.createQuery(criteriaQuery).getResultList();
任何帮助都受到高度赞赏?