s.persist( email );
}
tx.commit();
s.close();
s = new FullTextSessionImpl( openSession() );
s.getTransaction().begin();
s.connection().createStatement().executeUpdate( "update Email set body='Meet the guys who write the software'");
s.getTransaction().commit();
s.close();
s = new FullTextSessionImpl( openSession() );
tx = s.beginTransaction();
QueryParser parser = new QueryParser("id", new StopAnalyzer() );
List result = s.createFullTextQuery( parser.parse( "body:write" ) ).list();
assertEquals( 0, result.size() );
result = s.createCriteria( Email.class ).list();
for (int i = 0 ; i < loop/2 ; i++)
s.index( result.get( i ) );
tx.commit(); //do the process
s.index( result.get(loop/2) ); //do the process out of tx
tx = s.beginTransaction();
for (int i = loop/2+1 ; i < loop; i++)
s.index( result.get( i ) );
tx.commit(); //do the process
s.close();
s = new FullTextSessionImpl( openSession() );
tx = s.beginTransaction();
result = s.createFullTextQuery( parser.parse( "body:write" ) ).list();
assertEquals( loop, result.size() );
for (Object o : result) s.delete( o );
tx.commit();