-->
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: ScrollableResults yields to OutOfMemory error
PostPosted: Tue Oct 13, 2009 1:49 am 
Newbie

Joined: Tue Oct 13, 2009 12:53 am
Posts: 1
Hi. I'm trying to index a complex entity from a table with approx.
100000 Entries. But after some (maybe 400) entries I got an out of memory error. Clearing the session or evicting the current object doesn't solve the problem. The Hibernate Version is 3.2.6 and the Database is Sybase Anywhere 9.0.2.
Any ideas would be helpful.

Regards

Bernd

public void buildIndex()
{
FullTextEntityManager ftem = Search.getFullTextEntityManager(em);
Session session = (Session) em.getDelegate();
ScrollableResults allContacts = session.createQuery("from Contact").scroll();

int count = 0;
while ( allContacts.next() ) {
Contact c = (Contact) allContacts.get(0);
log.debug("Indexing " + count + " : "+ c.getDisplayRepresentation() );
ftem.index(c);
session.clear();
}
}


Top
 Profile  
 
 Post subject: Re: ScrollableResults yields to OutOfMemory error
PostPosted: Tue Oct 13, 2009 2:55 am 
Hibernate Team
Hibernate Team

Joined: Fri Oct 05, 2007 4:47 pm
Posts: 2536
Location: Third rock from the Sun
Hi,
look into the reference documentation of Hibernate Search: there's an example for efficient indexing: Example 6.2

* you're missing the flushToIndexes statement
* how are transactions handled?

Using hibernate 3.2.6 suggest you're using an old version of Hibernate Search, when flushToIndexes was not available. I'd advise to upgrade to Search 3.1.1; otherwise you'll have to split the task in several transactions: index changes are enqueued until transaction commit and are filling up memory.

_________________
Sanne
http://in.relation.to/


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.