-->
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: Problem in retreiving large number of documents in Hibernate
PostPosted: Thu Jan 13, 2005 5:55 am 
Newbie

Joined: Tue Dec 28, 2004 6:25 am
Posts: 16
Hi,
In my application I am using Hibernate to access the database(oracle). When the number of records retreived is less, no problem arises and the application proceeds smoothely.

But when the number of records accessed becomes greater than 1 lakh, Hibernate creates problem and the error coming is :

[b]java.lang.OutOfMemoryError[/b]

But when we use JDBCTemplate to retreive the same number i.e more than 1 lakh records no problem arises, and the application proceeds smoothely.

We are using Hibernate through out in the application, but this scenario(of retrieving large number of records) is creating a bottleneck in using Hibernate.

Can anyone please suggest how we can use Hibernate to retreive large number of records.

I using getHibernateTemplate().find() method to interact with the database.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 13, 2005 6:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
start with using iterate instead - or even better read the FAQ about processing large number of records....

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 13, 2005 6:27 am 
Newbie

Joined: Tue Dec 28, 2004 6:25 am
Posts: 16
Hi Max,

can you give a rough idea about how to use iterate and also

from where to read FAQ about processing large number of records in HIBERNATE


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jan 13, 2005 6:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
Please read the docs, buy the book or even get commercial support - this is in the basics of how to use hibernate.

Blog entry about large data processing...
http://blog.hibernate.org/cgi-bin/blosx ... batch.html

but please note that you should always look for how you use lazy loading (or not using which sounds likely in your case), batch, fetch queries etc. before looking at using evict as in the blog above.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 14, 2005 3:10 am 
Newbie

Joined: Tue Dec 28, 2004 6:25 am
Posts: 16
Hi,

Thanks Max for all your suggestions. Using batch processing in hibernate also didnt solve the outofmemory exception problem.

I want to clearly explain you the scenarion of the application so that you can have an exact picture.

There is a document table in my database (Oracle) which contains round about 3 lakh records. This table is not linked with any other tables, so the question of lazy loading i think is not here.

In one specific scenario, the application fetches more than 2 lakh records from the document table.

Using batch processing, the out of memory exception came after fetching round about 50000 records. Flusing of the session cache is done after you finish retreiving all the records and try to update the database. But in my case during retreving only 2 lakhs records are coming , which is causing the outofmemory exception.

Somehow we need to flush the cache while retreiving data from the database, so that we can fetch 2 lakh records without memory exception.

Waiting for new solutions :-)


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.