I have a new problem, I took 4 hours to solved it but I did't.
I added a "Categorie" class :
Code:
@Indexed
public class Categorie
{
@DocumentId
private Integer id;
@Field(index=Index.TOKENIZED, store=Store.YES)
private String nom;
public Categorie() {}
public Categorie(String nom)
{
this.nom = nom;
}
// getters and setters
and modifed "Entite" class :
Code:
@Indexed
public class Entite
{
@DocumentId
private Integer id;
@Field(index=Index.TOKENIZED, store=Store.YES)
private String titre;
@IndexedEmbedded
private List<Document> documents;
@IndexedEmbedded
private Categorie categorie;
public Entite() { }
public Entite(String titre, Categorie categorie)
{
documents = new ArrayList<Document>();
this.titre = titre;
this.categorie = categorie;
}
// getters and setters
}
If my code is
Code:
Transaction tx = session.beginTransaction();
Categorie categorie = new Categorie("nomcategorie");
Entite entite1 = new Entite("entite 1", categorie);
FullTextSession fullTextSession = Search.createFullTextSession(session);
session.persist(entite1);
tx.commit();
fullTextSession.index(entite1);
then the indexes are good.
if my code is :
Code:
Transaction tx = session.beginTransaction();
Categorie categorie = new Categorie("nomcategorie");
Entite entite1 = new Entite("entite 1", categorie);
FullTextSession fullTextSession = Search.createFullTextSession(session);
session.persist(entite1);
tx.commit();
HibernateUtil.closeSession();
session = HibernateUtil.getCurrentSession();
entite1 = (Entite) session.get(Entite.class,new Integer(1));
fullTextSession = Search.createFullTextSession(session);
fullTextSession.index(entite1);
then in my Entite indexes, categorie.nom value is "<not available>" and I don't know why.