amin-mc wrote:
Hi
I haven't done much with JPA and therefore I could be wrong in suggesting this but have you tried doing
Code:
FullTextEntityManager fullTextEntityManager = org.hibernate.search.jpa.Search.getFullTextEntityManager(em);
fullTextEntityManager.setFlushMode(FlushMode.MANUAL);
org.hibernate.Transaction tx = fullTextEntityManager.getTransaction();
tx.begin();
...rest of work
fullTextEntityManager.index(result.get(0));
fullTextEntityManager.flushToIndexes();
fullTextEntityManager.clear();
....
results.close();
tx.commit();
I haven't tested this but it might be worth having a go (you could refer to the online documentation as well)
HTH
thank you for the answer, but the instruction:
fullTextEntityManager.setFlushMode(FlushMode.MANUAL);
cannot be processed because the FlushMode of a fullTextEntityManager can be set only as AUTO or COMMIT.
I used AUTO setting...i have launched the program but i got this exception
Code:
javax.ejb.EJBTransactionRolledbackException: A JTA EntityManager cannot use getTransaction()
I also tried to launch the program without the flushToIndexes() and it takes over 7 hours to index 1 milion of records...is it possible? there are only 3 field to be indexed in the class.