1 Reply Latest reply on Dec 6, 2007 1:55 PM by norman.richards

    Hibernate Search with Seam works?

    srpantano

      I put in my persistence.xml:

      <property name="hibernate.search.default.directory_provider"
       value="org.hibernate.search.store.FSDirectoryProvider"/>
       <property name="hibernate.search.default.indexBase"
       value="C:\temp\indexes"/>
      
       <property name="hibernate.ejb.event.post-insert" value="org.hibernate.search.event.FullTextIndexEventListener"/>
       <property name="hibernate.ejb.event.post-update" value="org.hibernate.search.event.FullTextIndexEventListener"/>
       <property name="hibernate.ejb.event.post-delete" value="org.hibernate.search.event.FullTextIndexEventListener"/>
      


      in my class:

      @Entity
      @Indexed
      public class License {
      
       @Id
       @DocumentId
       @GeneratedValue(strategy = GenerationType.AUTO)
       @NotNull
       private Long id;
      
       @NotNull
       @Length(min = 3, max = 30)
       @Field(index=TOKENIZED, store=YES)
       private String sufix;
      
       ...
      
      }
      


      I put too the Hibernate-Search, Lucene-core and Hibernate-common-annotation that cames with Seam 2.
      I'm using Jboss 4.2.2 then when the project deploys it show that is using Hibernate EntityManager 3.2.1, Hibernate Annotations 3.2.1 and Hibernate 3.2.4.sp1.

      but On updates or inserts the follow error appear:

      Caused by: java.lang.NoSuchMethodError: org.apache.lucene.document.Document.add(Lorg/apache/lucene/document/Field;)V
       at org.hibernate.search.engine.DocumentBuilder.getDocument(DocumentBuilder.java:234)
       at org.hibernate.search.event.FullTextIndexEventListener.onPostUpdate(FullTextIndexEventListener.java:165)
       at org.hibernate.action.EntityUpdateAction.postUpdate(EntityUpdateAction.java:180)
      


      If I remove the:

       <property name="hibernate.ejb.event.post-insert" value="org.hibernate.search.event.FullTextIndexEventListener"/>
       <property name="hibernate.ejb.event.post-update" value="org.hibernate.search.event.FullTextIndexEventListener"/>
       <property name="hibernate.ejb.event.post-delete" value="org.hibernate.search.event.FullTextIndexEventListener"/>
      


      I insert and update records, nothing happens and I try this:

      @In FullTextEntityManager entityManager;
      
      ...
      
      List<License> ls = licenses.getResultList();
      
       for (License license : ls) {
      
       entityManager.index(license);
      
       }
      


      the exception appears:
      Caused by: org.hibernate.HibernateException: Lucene event listener not initialized
      


      I ask, Is it Hibernate-search with Seam works?