-->
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: SQLException with Lucene
PostPosted: Mon Nov 16, 2009 9:51 am 
Newbie

Joined: Wed Mar 30, 2005 5:41 am
Posts: 6
Hi,

we are doing a lucene redindexing by iteration over all related classes using flushToIndexes.
Now we got this exception on a large db.

Any ideas?

Thanks,
jens bruhn


org.hibernate.exception.GenericJDBCException: could not advance using next()
at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:126)
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:114)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:52)
at org.hibernate.impl.ScrollableResultsImpl.next(ScrollableResultsImpl.java:127)
...
Caused by: java.sql.SQLException: Operation not allowed after ResultSet closed
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1055)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:926)
at com.mysql.jdbc.ResultSetImpl.checkClosed(ResultSetImpl.java:768)
at com.mysql.jdbc.ResultSetImpl.next(ResultSetImpl.java:7008)
at com.mchange.v2.c3p0.impl.NewProxyResultSet.next(NewProxyResultSet.java:2859)
at org.hibernate.impl.ScrollableResultsImpl.next(ScrollableResultsImpl.java:122)
... 54 more


Top
 Profile  
 
 Post subject: Re: SQLException with Lucene
PostPosted: Mon Nov 16, 2009 10:38 am 
Pro
Pro

Joined: Wed Oct 03, 2007 2:31 pm
Posts: 205
Is it possible to see the code which you are using to re-index? Are you using a ScrollableResultSet?


Top
 Profile  
 
 Post subject: Re: SQLException with Lucene
PostPosted: Mon Nov 16, 2009 11:00 am 
Newbie

Joined: Wed Mar 30, 2005 5:41 am
Posts: 6
sure :)


Code:
List<Class<?>> indexedClassList = getIndexedClassList(transaction); //returns list with all classes to index

        FullTextSession fullTextSession = Search.getFullTextSession(transaction.getSession());
        fullTextSession.setFlushMode(FlushMode.MANUAL);
        fullTextSession.setCacheMode(CacheMode.IGNORE);

        for (Class<?> materialKlasse : indexedClassList)
        {
            ScrollableResults results = fullTextSession.createCriteria(materialKlasse)
                    .setFetchSize(20)
                    .scroll(ScrollMode.FORWARD_ONLY);
            int index = 0;
            while (results.next())
            {
                index++;
                Object entity = results.get(0);
                if (fullTextSession.getSearchFactory().getDirectoryProviders(entity.getClass()) != null)
                {
                    fullTextSession.index(entity); // index each element
                }
               
      if (index % 20 == 0)
                {
                    fullTextSession.flushToIndexes();
                    fullTextSession.clear(); // clear every batchSize since the queue is processed
                }
            }
        }
        transaction.savepoint();
        transaction.getSession().clear();


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.