JPA 2 CriteriaQuery, using a limit
I am using JPA 2. For safety reasons, I am working type safe with CriteriaQuery's (and thus, I am not searching for any solutions to typed queries and so on). I recently came across an issue in which I needed to set a SQL-LIMIT. After a lot of searching, I was still not successful in finding a solution. CriteriaQuery<Product> query = getEntityManager().getCriteriaBuilder().createQuery(Product.class); Root<Product> product = query.from(Product.class); query.select(product); return em.createQuery(query).getResultList(); Can anyone help me? Francisco Spaeth Define limit and offset on the Query :