-->
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.  [ 3 posts ] 
Author Message
 Post subject: HibernateSearch Perhaps I found a bug or a feature
PostPosted: Mon Apr 30, 2007 11:01 am 
Newbie

Joined: Fri Apr 20, 2007 10:31 am
Posts: 10
Yes, I know ist is a little bit "dangerous" to tell about a found bug, but I think i really found one.
If not, please don´t be angry...

This is the situation:

I use:


    Hibernate Core 3.2.3 GA
    Hibernate Annotations 3.3.0 GA
    Hibernate Search 3.0.0 Beta1


Hibernate Mappings are made in *.hbm.xml, not with annotations, my hibernate.cfg.xml contains the following:



Code:
         <!--  Konfigurationen für Hibernate Search  -->
         <property name="hibernate.search.default.directory_provider">
            org.hibernate.search.store.FSDirectoryProvider
         </property>
         <!--  Ende Konfigurationen für Hibernate Search  -->   
....

       <event type="post-update">
          <listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
       </event>
       <event type="post-insert">
          <listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
       </event>
       <event type="post-delete">
          <listener class="org.hibernate.search.event.FullTextIndexEventListener"/>
       </event>



Now I try to Index this structure:


Code:

@Indexed
public class TEvent implements java.io.Serializable {

   // Fields
   @DocumentId
   private Long eventId;

   @IndexedEmbedded
   private TAgent TAgent;

   private TArticleType TArticleType;

   @IndexedEmbedded
   private TLocation TLocation;
...

}


public class TAgent implements java.io.Serializable {

   // Fields   

   @Field(index = Index.UN_TOKENIZED)
   private Long agentId;

   @Field(index = Index.TOKENIZED)
   private String name;

    private Set<TSystemEvent> TSystemEvents = new HashSet<TSystemEvent>(0);

   @ContainedIn
   private Set<TEvent> TEvents = new HashSet<TEvent>(0);

....

}


/* Indexing: */

   @Test
   @Categories({"hibernate"})
   @SuppressWarnings("unchecked")
   public void indiziereTevents()
   {
      List<TEvent> eventList = new TEventHome().findAll();

      FullTextSession fullTextSession = Search.createFullTextSession(HibernateUtil.getCurrentSession());
      Transaction transaction = fullTextSession.beginTransaction();
      for(TEvent event : eventList)
      {
         System.out.println("*********  event.getTAgent().getAgentId(): "  +event.getTAgent().getAgentId());
         System.out.println("*********  event.getTAgent().getName: "  +event.getTAgent().getName());

         fullTextSession.index(event);
      }
      transaction.commit();
   }




Now for example, I will only have the field TAgent.Name in the lucene index, when TAgent is fetched eager:

Code:
TEvent.hbm.xml:

        <many-to-one name="TAgent" class="com.......hibernate.core.pojo.TAgent" fetch="select" lazy="false">
            <column name="AGENT_ID" precision="22" scale="0" not-null="true" />
        </many-to-one>


this won´t work:

Code:
TEvent.hbm.xml:

        <many-to-one name="TAgent" class="com.......hibernate.core.pojo.TAgent" fetch="select" >
            <column name="AGENT_ID" precision="22" scale="0" not-null="true" />
        </many-to-one>


Even when I Print out the fields to index with System.out (then they are loaded, lazy or not) bevor doing fullTextSession.index(event); they won´t be in the index.


Perhaps this is a bug, or I made a mistake (where could it be?).
Perhaps someone knows a workararound.

btw Another thing is, that I cant index more than one time "embedded": http://forum.hibernate.org/viewtopic.php?t=973864
, perhaps a bug to? (Or both is my mistake...)


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 01, 2007 3:51 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I noticed an issue about lazy object when inside a Java EE container (actually when using a JTA transaction), I want to fix it for the next release.
I would apreciate if you could create a unit test case a post it to a JIRA issue, so that I can double check it.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 03, 2007 10:56 am 
Newbie

Joined: Fri Apr 20, 2007 10:31 am
Posts: 10
I will sent you a test environment (I actually make one).

_________________
Meine Webseite (German):

Germanische Mythologie


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

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.