public List<Employee> getEmployeesWithPhoneKinds(EnumSet<PhoneType> phoneTypes)
	{
		String queryPattern = "SELECT e FROM Employee e WHERE %s EXISTS(SELECT 1 FROM e.phones p WHERE KEY(p)=:firstType) AND %s EXISTS(SELECT 1 FROM e.phones p WHERE KEY(p)=:secondType)";
		TypedQuery<Employee> query = null; 
		
		if (phoneTypes.isEmpty())
		{
			queryPattern = String.format(queryPattern, "NOT", "NOT");
			query = manager.createQuery(queryPattern, Employee.class).setParameter("firstType", PhoneType.HOME).setParameter("secondType", PhoneType.MOBILE);
		}
		else
		{
			if (phoneTypes.size() == 1)
			{
				queryPattern = String.format(queryPattern, "", "NOT");
				query = manager.createQuery(queryPattern, Employee.class).setParameter("firstType", phoneTypes.toArray()[0]).setParameter("secondType", phoneTypes.complementOf(phoneTypes).toArray()[0]);
			}
			else
			{
				queryPattern = String.format(queryPattern, "", "");
				Object[] types = phoneTypes.toArray();
				query = manager.createQuery(queryPattern, Employee.class).setParameter("firstType", types[0]).setParameter("secondType", types[1]);
			}
		}
		
		return query.getResultList();
	}