-->
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: Out of Memory with First time Full text search indexcreation
PostPosted: Mon Oct 08, 2007 3:28 pm 
Newbie

Joined: Mon Oct 08, 2007 3:13 pm
Posts: 6
Hi All

I am using hibernate core 3.2, spring 2.0, struts 1.3, with hibernate search 3.0 jar. my database is mysql 5.0.
I want to create full text search index first time for a database table with 277917 records.

I have put below parameters in my eclipse.ini file but it still throws Out of Memory exception.
-vmargs
-Xms1024M
-Xmx1024M

Any idea how to resolve it?

I have set hibernate.search.worker.batch_size = 100 in hibernate property, and in hibernate domain class i have set @field annotation to only 2 fields.


public void createFirstTimeIndex(){

Session session = getHibernateTemplate().getSessionFactory().openSession();
FullTextSession fullTextSession = Search.createFullTextSession(session);
Transaction transaction = fullTextSession.beginTransaction();

fullTextSession.setFlushMode(FlushMode.MANUAL);
fullTextSession.setCacheMode(CacheMode.IGNORE);
transaction = fullTextSession.beginTransaction();
// Scrollable results will avoid loading too many objects in memory
ScrollableResults results = fullTextSession.createCriteria( myTable.class ).scroll( ScrollMode.FORWARD_ONLY );
int index = 0;
while( results.next() ) {
index++;
fullTextSession.index( results.get(0) ); //index each element
if (index % 100 == 0)
{
fullTextSession.clear();
session.clear(); //clear every batchSize since the queue is processed
}
}
transaction.commit();
fullTextSession.close();
session.close();
}



<bean id="myhibernateProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySqlDialect</prop>
<prop key="hibernate.query.substitutions">true 'T', false 'F'</prop>
<prop key="hibernate.show_sql">false</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.max_fetch_depth">1</prop>
<prop key="hibernate.use_sql_comments">true</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>
<prop key="hibernate.search.default.indexBase">c:\\lucene\\indexes</prop>
<prop key="hibernate.search.worker.batch_size">100</prop>
</props>
</property>

</bean>

<!-- LocalSessionFactoryBean From spring jar file -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" >
<ref bean="jndi_mysql_datasrc" />
</property>
<property name="hibernateProperties" >
<ref bean="myhibernateProperties" />
</property>
<property name="mappingDirectoryLocations" >
<list>
<value>classpath:/hbm </value>
</list>
</property>
<property name="eventListeners" >
<map>
<entry key="post-insert">
<bean class="org.hibernate.search.event.FullTextIndexEventListener"></bean>
</entry>
<entry key="post-update">
<bean class="org.hibernate.search.event.FullTextIndexEventListener"></bean>
</entry>
<entry key="post-delete">
<bean class="org.hibernate.search.event.FullTextIndexEventListener"></bean>
</entry>
</map>
</property>
</bean>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 09, 2007 3:21 pm 
Newbie

Joined: Mon Oct 08, 2007 3:13 pm
Posts: 6
My mistake..

I am using Lomboz with Eclipse, and when i was setting memory as i mentioned earlier in eclipse, that time it was not actually going to server.

I have to pass extra memory to server, which i did in different way and i am good now.

Thanks any way.


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.