Using JPA query language, how do I determine the size (number of rows) in an entity (table)?
+4
A:
Use the count aggregate function:
EntityManager em = ...
Query q = em.createQuery ("SELECT count(x) FROM Magazine x");
Number result = (Number) q.getSingleResult ();
Joshua
2009-05-13 17:44:11