-->
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: Insert many objects/OutOfMemory/FullTextIndexEventListener
PostPosted: Sat Mar 10, 2007 4:56 pm 
Newbie

Joined: Fri Jun 24, 2005 4:36 am
Posts: 14
Location: Germany
While inserting many objects in a batch the application runs out of memory because the FullTextIndexEventListener for Lucene collects the updates. Is there a way to avoid this?

hibernate.cfg.xml
Code:
<event type="post-insert">
  <listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
</event>


Inserting code something like:
Code:
Session session = sessionFactory.openSession();
session.setCacheMode(CacheMode.IGNORE);
Transaction tx = session.beginTransaction();
for ( int i=0; i<100000; i++ ) {
  Item item = new Item(...);
  session.save(item);
  if ( i % 100 == 0 ) {
    session.flush();
    session.clear();
  }
}
tx.commit();
session.close();


Top
 Profile  
 
 Post subject:
PostPosted: Sun Mar 11, 2007 7:59 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
This is a tough problem. Today the solution is to apply the work in n transactions rather than 1. I think I will introduce the notion of batch_size at some point to force a "flush" when the queue goes up. But it sacrifices the transactional semantic.

Can you opena JIRA issue please, so that the feature request is not lost.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 12, 2007 3:52 am 
Newbie

Joined: Fri Jun 24, 2005 4:36 am
Posts: 14
Location: Germany
OK, please correct if necessary.

http://opensource.atlassian.com/project ... HSEARCH-33


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.