Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[eclipselink-users] total rowCount with JPA

Hello

I know how to implement pagination, using JPA.

But I also would like to know how I can get the total number of results.

For example Hibernate uses a projection for this(see below), but how can I do this using JPA?

criteria.setFirstResult(0);
criteria.setMaxResults(java.lang.Integer.MAX_VALUE);
criteria.setProjection(Projections.rowCount());
int rowCount = (Integer) criteria.list().get(0);

Leon




Back to the top