CriteriaBuilder builder = em.getCriteriaBuilder();
CriteriaQuery criteriaQuery = builder.createQuery(clazz.getClass());
Root root = criteriaQuery.from(clazz.getClass());
Predicate predicate = spec.toPredicate(root, criteriaQuery, builder);
criteriaQuery.where(predicate);
List<Object> objects = em.createQuery(criteriaQuery).getResultList();
if (ids != null) {
if (objects.size() == ids.length) {