[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - How to use EntityManager for SELECT COUNT(1)?

tonylmai do-not-reply at jboss.com
Tue Aug 14 20:34:27 EDT 2007


Hello,

Would someone help me on how to perform a "select count(1) from TableA"?

I have the following code but that it does not seem to work.

int rowCnt= (Integer) em.createQuery("SELECT count(1) FROM TableA").getSingleResult();

I am using JBoss 4.2.1GA. 

Much appreciated.
-tony

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4074232#4074232

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4074232



More information about the jboss-user mailing list