-->
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: ScrollableResults
PostPosted: Sat Sep 11, 2004 2:29 am 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
Hibernate version:
2.1.6

Name and version of the database you are using:
SQLServer2000 ( jTDSDriver )

I have a problem when trying to select all rows from a large table ( 1.5 million rows ). Doing a simple find( "from MyObject" ) seems will run into garbage collection problems as the combined temporary overhead of hibernate and the JDBC driver uses a lot of memory which needs to be garbage collected regularly. I set my VM options to min and max memory of 1gig and I see this behaviour.

Start fines, CPU maxes out as rows are retrieved.
JVM hits the 1gig limit ( combined JDBC, hibernate and return objects ) so it runs a GC to cleanup some room.
Runs for a bit longer at max CPU then hits the mem limit and GCs again.
And so on until all the rows come back.

This takes approximate 10 mins to run because of all the garbage collection that is required ( the used space at the end is only 150meg ) so I was wondering if ScrollableResults would solve this problem without a performance penalty. Something like...

Code:
Query q = session.createQuery( "from MyObject" );
ScrollableResults sr = q.scroll();

// loop over scrollable results....
while ( sr.next() )
{
    Object[] row = sr.get();

    // process row
}


Is there any way of getting the MyObject back out of a scrollable results or is it always a flat array like JDBC?

Cheers.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 11, 2004 2:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
http://blog.hibernate.org/cgi-bin/blosx ... 8/27#batch


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 11, 2004 5:07 am 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
Thanks. Exactly what I'm looking for. I would say that although ideally ORM isn't suited to bulk operations, it can be VERY useful to use hibernate. For example we migrate data from an old version to a new one, which may be SQLServer/Oracle/MySQL/Sybase etc so using hibernate objects allows the details of the db load and save to be hidden and the object manipulation from the old to new version easy and generic.

Cheers.


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.