标签:
EntityManager entityManager;
CriteriaBuilder criteriaBuilder =entityManager.getCriteriaBuilder();
CriteriaQuery<Entity> critQuery = criteriaBuilder.createQuery(实体类.class);
Root<实体类> root = critQuery.from(实体类.class);
Predicate predicate = criteriaBuilder.equal(root.get(字段).as(Integer.class),"条件参数");
critQuery.where(predicate);
return entityManager.createQuery(critQuery).getResultList().size();
标签:
原文地址:http://www.cnblogs.com/zhuzhiq/p/5584958.html