Using JPA query language, how do I determine the size (number of rows) in an entity (table)?
Asked
Active
Viewed 6,183 times
1 Answers
23
Use the count aggregate function:
EntityManager em = ...
Query q = em.createQuery ("SELECT count(x) FROM Magazine x");
Number result = (Number) q.getSingleResult ();

Joshua
- 26,234
- 22
- 77
- 106