-->
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.  [ 3 posts ] 
Author Message
 Post subject: Scrolling equivalent to CURSOR.next()??
PostPosted: Thu Apr 07, 2005 2:36 pm 
Beginner
Beginner

Joined: Thu May 20, 2004 3:40 pm
Posts: 33
Read the rules before posting!
http://www.hibernate.org/ForumMailingli ... AskForHelp

Hibernate version: 3.0
Just a general question.....

Does hibernate have an equivalent next() method that will go to the db to get the next row??

SITUATION:

I would like to process about 5 million rows.
I do not want to load all those object into memory. I want to be able to do a next().

Does the Hibernate Query.scroll() check the cache first or it goes directly to the "cursor/resultset" and then creates the object as you call q.scroll??

Thanks,

Kenny





Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 08, 2005 11:29 am 
Pro
Pro

Joined: Mon Jan 24, 2005 5:39 am
Posts: 216
Location: Germany
Just use something like

Query q = session.createQuery("from User as u where u.userName = ?");
q.setString(0, "Gerhard");
ScrollableResults users = q.scroll();
while ( users.next() ) {
User user = (User) users.get(0);
}

This worked for us. We could manage very large
number of objects.
Hope this helps.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 11, 2005 2:26 pm 
Beginner
Beginner

Joined: Thu May 20, 2004 3:40 pm
Posts: 33
Will do!!

Thanks,

Kenny


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