0

I m trying to integrate hibernate search in my existing application. According to the tutorial of hibernate search i have added following properties in hibernate properties in applicationContext.xml

<prop key="hibernate.search.default.directory_provider">org.hibernate.search.store.FSDirectoryProvider</prop>  
<prop key="hibernate.search.default.indexBase">./lucene/indexes</prop> 

Also i have added the annotation on the entity classes for which i want to enable search. Using @Indexed on class and @Field on the fields.

Following are the versions i am using (I'm not using maven):

  • hibernate-search - 3.2.0.Final
  • hibernate-commons-annotations 4.0.1.Final
  • hibernate-core - 4.1.11 Final
  • hibernate-entitymanager - 3.4.0.GA
  • spring - 3.2.2 REALEASE
  • lucene-core - 3.2.0

and I'm using this sample code to perform a search in MySQL database :

public void search() {

FullTextSession searchSession = Search.getFullTextSession(sessionFactory.getCurrentSession());

QueryParser parser = new QueryParser(Version.LUCENE_32, "contenu", new StandardAnalyzer(Version.LUCENE_32));

org.apache.lucene.search.Query query = parser.parse("décarbonateront");

org.hibernate.Query hibQuery = searchSession.createFullTextQuery(query, Book.class);

List result = hibQuery.list();

System.out.println("lucene results: " + result.size());

}

But I get this error : The type org.hibernate.classic.Session cannot be resolved. It is indirectly referenced from required .class files

at : searchSession.createFullTextQuery(query, Book.class);

What can be the problem ??

1
  • add hibernate.jar in your classpath to solve the issue Commented Sep 5, 2013 at 5:07

1 Answer 1

1

You need to align the Hibernate and Hibernate Search versions. You need Hibernate 3.5.x for Hibernate Search 3.2. Check the versions for example in the Maven pom - https://repository.jboss.org/nexus/content/repositories/public/org/hibernate/hibernate-search-parent/3.2.0.Final/hibernate-search-parent-3.2.0.Final.pom.

You could also download the Hibernate Search distribution from Sourceforge. The distribution contains all the right dependencies as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.