-->
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.  [ 5 posts ] 
Author Message
 Post subject: How to get the size of a ScrollableResults
PostPosted: Tue Sep 09, 2003 9:34 pm 
Beginner
Beginner

Joined: Tue Aug 26, 2003 11:33 pm
Posts: 38
I want to get the number of objects returned from a Query. I get the query result as the form of a ScrollableResults. But how do I get the number of objects contained in this ScrollableResults ?

Any help is appreciated .


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 09, 2003 11:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Woops. I thought I added the getRowNumber() method ages ago .... but I didn't, apparently :(

Why exactly are you using ScrollableResults for?? This is a very exotic feature. Usually there are better ways.


Top
 Profile  
 
 Post subject: Because I use hibernate 2.0.3 to randomly fetch object
PostPosted: Wed Sep 10, 2003 2:55 am 
Beginner
Beginner

Joined: Tue Aug 26, 2003 11:33 pm
Posts: 38
With your advice, I'd like to use the index() HQL function to randomly get objects from a query, but that's only implemented in 2.1.X. So I have to use ScrollableResults to gain comparable performance. Now I want to randomly select questions from a huge number of questions out of some query. I need the query result size to generate an random int array, with which to randomly select records.

Any advice ?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 10, 2003 3:32 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
issue a count() query beforehand, thats the only way i know...


Top
 Profile  
 
 Post subject: I'll use count()
PostPosted: Wed Sep 10, 2003 4:57 am 
Beginner
Beginner

Joined: Tue Aug 26, 2003 11:33 pm
Posts: 38
Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.