4 Replies Latest reply on Jun 29, 2006 11:55 AM by Sebastian Menge

    Lucene index on Entity beans problem

    Louis Coetzee Apprentice

      Hi,

      According to the Hibernate Annotation documentation a person can use an Annotation (@Indexed) to mark a domain object as indexable and have Hibernate maintain the Lucene index (p38 of hibernate_annotations.pdf).


      @Entity
      @Indexed(index="/tmp/lucene.index")
      @Name("lucene_example_data")
      @Table(name="lucene_example_data")
      public class LuceneExampleData implements Serializable {
      .
      .
       @Id(generate = GeneratorType.AUTO)
       @Column(name="id",unique=true)
       @Keyword(id=true)
       public Long getId() {
       return id;
       }
      .
      .
       @Text
       public String getMessage() {
       return message;
       }
      .
      


      I have tried to configure my hibernate.cfg.xml as suggested and have added the various annotations to my entity. Unfortunately it appears as if the Listener methods never gets executed.

      <hibernate-configuration>
       <session-factory>
       <listener type="post-commit-update" class="org.hibernate.lucene.event.LuceneEventListener"/>
       <listener type="post-commit-insert" class="org.hibernate.lucene.event.LuceneEventListener"/>
       <listener type="post-commit-delete" class="org.hibernate.lucene.event.LuceneEventListener"/>
      
       <!--
       <event type="post-commit-update">
       <listener class="org.hibernate.lucene.event.LuceneEventListener"/>
       </event>
       <event type="post-commit-insert">
       <listener class="org.hibernate.lucene.event.LuceneEventListener"/>
       </event>
       <event type="post-commit-delete">
       <listener class="org.hibernate.lucene.event.LuceneEventListener"/>
       </event>
       -->
       </session-factory>
      </hibernate-configuration>




      I am using jboss 4.0.3 installed with ejb3 with my application using Seam.

      I have tried to increase my log level in server/default/conf/log4j.xml (as shown below) to hopefully see the events, unfortunately no go.

      <category name="org.hibernate.lucene">
       <priority value="TRACE" class="org.jboss.logging.XLevel"/>
      </category>
      





      Any suggestions ?

      Thanks

      Louis