-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: counting number of rows without retrieving data
PostPosted: Wed Sep 14, 2005 9:21 am 
Newbie

Joined: Wed Sep 14, 2005 9:16 am
Posts: 1
I am trying to retrieve the number of rows returned with out retrieving the data, can anyone help me how to do this.

I tried some thing like this
select count(*) from table11 join.. where ....

Usually select .. from ... returns a list but I need the result into an int variable which gives me the number of rows with out bringing in the rows.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 14, 2005 10:22 am 
Regular
Regular

Joined: Sun Nov 07, 2004 3:39 pm
Posts: 77
From the docs (http://www.hibernate.org/hib_docs/refer ... hql-select
)

You can find the size of a collection without initializing it:

( (Integer) session.iterate("select count(*) from ....").next() ).intValue();


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.