Within the context of your UserTransaction (if your persistence unit has Tx type JTA) or
Hibernate Session (if you're managing this manually), I'd execute an EJBQL
"COUNT" Function to get a slim-and-trim resultant SQL Query sent to your DB.
Integer objId = [whatever your PK is];
| EntityManager em = [wherever you get your EM from];
| Integer count = (Integer)(em.createQuery("SELECT COUNT(obj.association) FROM
" + YourEntityBean.class.getName()
| + " obj WHERE obj.id =
:objId").setParameter("objId",objId).getSingleResult());
You don't really want to be "loading" anything if you don't need these
objects....just the count.
S,
ALR
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085051#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...