This content has been marked as final.
Show 4 replies
-
1. Re: How to use EntityManager for SELECT COUNT(1)?
fernando_jmt Aug 15, 2007 7:43 PM (in response to tonylmai)If you're trying to execute an SQL (not JPA QL), just try with this:
int rowCnt= (Integer) em.createNativeQuery("SELECT count(1) FROM TableA").getSingleResult();
HTH. -
2. Re: How to use EntityManager for SELECT COUNT(1)?
fhh Aug 16, 2007 3:38 AM (in response to tonylmai)Or you could try
SELECT count(a) FROM TableA
(untested)
Regards
Felix -
3. Re: How to use EntityManager for SELECT COUNT(1)?
christian.bauer Aug 16, 2007 4:41 AM (in response to tonylmai)count() returns a Long, not an Integer.
-
4. Re: How to use EntityManager for SELECT COUNT(1)?
tonylmai Aug 16, 2007 4:55 PM (in response to tonylmai)Thanks for all your help. You guys are the greatest. :-)