public List<Employee> getEmployeesWithSallaryHigherThenAvgSallaryInDepartmentCriteria()
	{
		CriteriaBuilder builder = manager.getCriteriaBuilder();
		
		CriteriaQuery<Employee> critQuery = builder.createQuery(Employee.class);
		Root<Employee> employeeRoot = critQuery.from(Employee.class);
		Subquery<Double> sallarySubQuery = critQuery.subquery(Double.class);
		Root<Employee> subqueryRoot = sallarySubQuery.from(Employee.class);
		sallarySubQuery.select(builder.avg(subqueryRoot.<Double>get("sallary"))).where(builder.equal(subqueryRoot.get("department"), employeeRoot.get("department")));
		
		critQuery.select(employeeRoot).where(builder.gt(employeeRoot.<Double>get("sallary"), sallarySubQuery));
		
		TypedQuery<Employee> typedQuery = manager.createQuery(critQuery);
		
		return typedQuery.getResultList();
	}