-->
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: Huge Data fetching problem
PostPosted: Thu Jan 12, 2012 5:26 am 
Newbie

Joined: Thu Jan 12, 2012 5:21 am
Posts: 1
Hi Guys

Hibernate version: Hibernate3
Oracle version: Oracle9
Java Version: j2sdk1.4.2_04

I have database where I have more than 100 thousand rows in one table.
If I try to fetch all at a time, I am getting java.lang.OutOfMemoryError

And if I try to fetch page by page e.g. by setting
criteria.setFirstResult(startIndex);
criteria.setMaxResults(25000);
Then in second or third query, I am again getting the same error.

How do I know what is a capacity of session to hold N number of objects? or I shall do some smart caching or flushing? Please suggest some intelligent way to get rid of outOfMemoryError.

FYI: The object I am facing is internally has references to three more tables. Ultimately I am fetching N * 4 objects. And my primary objects has more than 15 columns, rest of the objects has 3 columns only.

Thanks and Regards
Kavan


Top
 Profile  
 
 Post subject: Re: Huge Data fetching problem
PostPosted: Thu Jan 12, 2012 8:54 am 
Senior
Senior

Joined: Tue Oct 28, 2008 10:39 am
Posts: 196
Do you need all the rows in memory at the same time?

If yes: More Memory.
If no: call session.flush(); session.clear(); after you did what you have to do after each chunk you loaded


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.