-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 22 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: Fri May 18, 2007 2:45 am 
Regular
Regular

Joined: Wed Apr 25, 2007 10:29 am
Posts: 110
Location: France
Hum, thank you ;)

What do you mean by "touch owning entity" ?

Will the problem be solved in Hibernate Search Beta 2 ? (I read it's complicated).

Now, there is no problem :) :

Code:
FullTextSession fullTextSession = Search.createFullTextSession(session);
      
Transaction tx = session.beginTransaction();            
Entite entite1 = new Entite("entite 1");
session.persist(entite1);
tx.commit();
      
tx = session.beginTransaction();
Document document1 = new Document("document 1");
entite1.getDocuments().add(document1);
fullTextSession.index(entite1);
tx.commit();


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 10:33 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
entity1.setName("New name"); touch the entity (mark it dirty) but it's not really practical.

The problem probably won't be solved for beta2, it will require a Hibernate Core change

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 18, 2007 11:01 am 
Regular
Regular

Joined: Wed Apr 25, 2007 10:29 am
Posts: 110
Location: France
Ok thank you Emmanuel !


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 21, 2007 11:39 am 
Regular
Regular

Joined: Wed Apr 25, 2007 10:29 am
Posts: 110
Location: France
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.


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 22, 2007 6:40 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Can you post a reproducible unit test case to JIRA, I'll need to have a look. I can't guess from what you are describing.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 23, 2007 4:43 am 
Regular
Regular

Joined: Wed Apr 25, 2007 10:29 am
Posts: 110
Location: France
I don't know if this is what you want, but I created an Eclipse project with a unit test (in main) : http://opensource.atlassian.com/project ... HSEARCH-59

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 25, 2007 3:27 am 
Regular
Regular

Joined: Wed Apr 25, 2007 10:29 am
Posts: 110
Location: France
Now it works with the last version of Hibernate Search. Thank you very much.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 22 posts ]  Go to page Previous  1, 2

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.