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