Hello:
I'm in glassfish 2.1 and JTA (I didn't tell you that, my bad !) and this is my index code :
Quote:
private void indexData(Object indexedClass,String fileUniqueKey)
{
FullTextSession fsession = Search.getFullTextSession(getHIbernateSession());
fsession.setFlushMode(FlushMode.MANUAL);
fsession.setCacheMode(CacheMode.IGNORE);
Class clss = Class.forName(indexedClass.getClass().getCanonicalName());
Criteria query = fsession.createCriteria(clss);
query.add(Restrictions.eq("uniqueTableKey", fileUniqueKey));
ScrollableResults results = query.scroll(ScrollMode.FORWARD_ONLY);
if (results != null)
{
Transaction tx = fsession.beginTransaction();
int index = 0;
while (results.next())
{
fsession.index(results.get(0));
if ((index % batch_zise) == 0)
{
fsession.flushToIndexes();
fsession.clear();
}
}
tx.commit();
Long endTime = System.currentTimeMillis();
getLog()
.log(
Level.INFO,
"Class " + clss.getName().toUpperCase() + " Indexed in: "
+ ((endTime - initTime) / 1000) + " SECS");
}
else
{
getLog()
.log(
Level.WARNING,
"NO SCROLLABLE RESULS IN CLASS " + clss.getName().toUpperCase());
}
I think i solved it anyway, initializing a new user transaction just before the index method and in the end of the method. But I'll appreciate if you tell me the reason of the exception..
Thanks.