-->
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.  [ 4 posts ] 
Author Message
 Post subject: Hibernate Search works?
PostPosted: Thu Dec 06, 2007 8:31 am 
Newbie

Joined: Wed Aug 29, 2007 2:09 pm
Posts: 6
I put in my persistence.xml:

Code:
<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"/>


On class:
Code:
@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 the Hibernate-Search 3.0.0, Lucene-core 2.20 and Hibernate-common-annotation 3.0.0.
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:

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


If I remove the:

Code:
<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!

After I try this:

Code:
FullTextEntityManager entityManager;

...

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


the exception appears:

Code:
Caused by: org.hibernate.HibernateException: Lucene event listener not initialized


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 06, 2007 11:48 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
It highly depends on how you "put" lucene.jar and hibernate-search.jar
Some people have incompatibilities with the hibernate annotations embedded with JBoss AS.
What I recommend is to replace hibernate annotations, hibernate entity manager and hibernate commons annotations jars into JBoss AS (usually in the JBOSS_HOME/server/default/lib dir). Then you can package hsearch and lucene in your war or ear the usual way

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 06, 2007 1:48 pm 
Newbie

Joined: Wed Aug 29, 2007 2:09 pm
Posts: 6
I tried this, but when I replace the libs in Jboss, the server doesn´t start.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Dec 06, 2007 5:42 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
you will have to be more explicit than that. Because it works for me :)

_________________
Emmanuel


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.