public List<Employee> getEmployyeeWithPhoneKindsCriteria(EnumSet<PhoneType> phoneTypes)
	{
		CriteriaBuilder builder = manager.getCriteriaBuilder();
		CriteriaQuery<Employee> critQuery = builder.createQuery(Employee.class);
		Root<Employee> root = critQuery.from(Employee.class);
		critQuery.select(root);
		Subquery<Integer> firstTypeSq = critQuery.subquery(Integer.class);		
		Root<Employee> firstSqRoot = firstTypeSq.correlate(root);
		MapJoin<Employee, PhoneType, Phone> firstSqPhoneJoin = firstSqRoot.joinMap("phones");
		firstTypeSq.select(builder.literal(1)).where(builder.equal(firstSqPhoneJoin.value().get("phoneType"), builder.parameter(PhoneType.class, "firstType")));
		Subquery<Integer> secondTypeSq = critQuery.subquery(Integer.class);
		Root<Employee> secondSqRoot = secondTypeSq.correlate(root);
		MapJoin<Employee, PhoneType, Phone> secondSqPhoneJoin = secondSqRoot.joinMap("phones");
		secondTypeSq.select(builder.literal(1)).where(builder.equal(secondSqPhoneJoin.value().get("phoneType"), builder.parameter(PhoneType.class, "secondType")));
		Predicate firstExistsPredicate = builder.exists(firstTypeSq);
		Predicate secondExistsPredicate = builder.exists(secondTypeSq);
		
		PhoneType firstParameter = null, secondParameter = null;
		if (phoneTypes.isEmpty())
		{
			firstExistsPredicate = builder.not(firstExistsPredicate);
			secondExistsPredicate = builder.not(secondExistsPredicate);
			firstParameter = PhoneType.HOME;
			secondParameter = PhoneType.MOBILE;
		}
		else
		{
				if (phoneTypes.size() == 1)
				{
					secondExistsPredicate = builder.not(secondExistsPredicate);
					firstParameter = (PhoneType)phoneTypes.toArray()[0];
					secondParameter = (PhoneType)phoneTypes.complementOf(phoneTypes).toArray()[0];
				}
				else
				{
					Object[] types = phoneTypes.toArray();
					firstParameter = (PhoneType)types[0];
					secondParameter = (PhoneType)types[1];
				}
		}
		
		Predicate finalPredicate = builder.and(firstExistsPredicate, secondExistsPredicate);
		critQuery.where(finalPredicate);
		
		TypedQuery<Employee> query = manager.createQuery(critQuery);
		query.setParameter("firstType", firstParameter);
		query.setParameter("secondType", secondParameter);
		
		return query.getResultList();
	}