select u from userentity u
...
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<userentity > q = cb.createQuery(userentity .class);
Root<userentity > c = q.from(userentity .class);
ParameterExpression<Integer> p = cb.parameter(Integer.class);
q.select(c).where(cb.gt(c.get("id"), p));
...