Good night, everyone.
I have just one class mapped by hibernate ( using annotations ) and this class is also annotated by hibernate search annotations.
It is an hibernate search test.
Code:
@Indexed(index="Convidado")
@Entity
public class Convidado {
@Id
@GeneratedValue
@DocumentId
private Long id;
@Field(index=Index.TOKENIZED, store=Store.YES)
private String nome;
@Temporal(TemporalType.DATE)
private Date dataNascimento; // data de nascimento para ver possiveis clientes
@Temporal(TemporalType.TIMESTAMP)
private Date dataCadastro;
// getters and setters
}
I have this code to index all data
Code:
FullTextSession fullTextSession = getFullTextSession();
Transaction tx = fullTextSession.beginTransaction();
tx.begin();
fullTextSession.setCacheMode(CacheMode.IGNORE);
fullTextSession.setFlushMode(FlushMode.MANUAL);
Paginacao pag = new Paginacao(1, 5000, 0, 0);
List<Convidado> convidados = getConvidadoDao().getLista(new Convidado(), pag);
for(Convidado e : convidados){
System.out.println("Indexing convidado "+e.getNome());
fullTextSession.index(e);
}
System.out.println("Finished");
if(tx.isActive()){
System.out.println("Transaction is active, it will commit now");
tx.commit();
System.out.println("Comitted");
}
I have just a few records on database to be indexed. ( about 8 )
i have the following output
Indexing convidado Helio Ricardo
Indexing convidado Flávia Trindade
Indexing convidado Neyde Vieira
Indexing convidado Walter Gomes
Indexing convidado Rita de Cássia
Indexing convidado Alex Dias
Finished
Transaction is active, it will commit now
Comitted
It runs until the last line of code but the program keeps running... To finish it, i have to stop manually.
It does index all data but it doesn't finish running. Yesterday i left running for almost an hour and it didn't stop.
Anybody can help me?