1

I have a fairly straight forward Spring Boot 1.5.2 application using Hibernate Search. JPA stuff works just fine.

I get Caused by: java.lang.ClassNotFoundException: org.hibernate.query.ParameterMetadata when running a search.

The code looks somewhat like this. Used to run in Wildfly, but I'm migrating to Spring Boot.

       FullTextEntityManager fullTextEntityManager = Search.getFullTextEntityManager(em);

    QueryBuilder qb = fullTextEntityManager.getSearchFactory()
            .buildQueryBuilder()
            .forEntity(Customer.class)
            .get();

    org.apache.lucene.search.Query
            luceneQuery = qb.keyword()
                .wildcard()
                .onField("primaryParty.firstName")
                .andField("primaryParty.sureName")
                .andField("customerNumber")
                .matching(query.trim() + "*")
                .createQuery();
    javax.persistence.Query jpaQuery =
            fullTextEntityManager.createFullTextQuery(luceneQuery, Customer.class);

    List<Customer> result = jpaQuery.getResultList();

Hibernate Core 5.0.12 is pulled in via Spring Boot, but the class is not there.

According to this: https://cia.sourceforge.io/tattleTaleReport/jar/hibernate-search-orm-5.7.0.Final.jar.html

i should expect to find it in hibernate-search-orm 5.7.0.Final. But from what I can see this jar only contains the org.hibernate.search package and no org.hibernate.query package. Can't find the class in any other package in that jar either, but it exists in a number of other packages on the class path.

Is the problem

javax.persistence.Query

If so, what to use instead? Or is the problem elsewhere?

2 Answers 2

5

Hibernate Search 5.7.0.Final is only compatible with Hibernate ORM 5.2.3.Final and later. You should either:

  • downgrade Hibernate Search to 5.6.1.Final
  • or upgrade Hibernate ORM to version 5.2.3.Final or later. With Spring Boot, I'm afraid you would have to use and unstable version of Spring Boot, namely 2.0.0.BUILD-SNAPSHOT

EDIT: actually, it seems you can use Hibernate ORM 5.2+ with Spring Boot 1.5; see this sample. Be careful to use 5.2.3.Final or later, though (the sample uses 5.2.0.Final, which won't work).


By the way, the link you provided only mentions org.hibernate.query because of OSGi support, which probably isn't relevant to you. It happens that hibernate-search-orm (the module integrating Hibernate Search to Hibernate ORM) both imports and re-exports the org.hibernate.query package, but it doesn't provide it itself.

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

Comments

0

I was getting the same issue due to using 5.7.0.Final jar and it was not compatible. This issue got resolved by changing downgrade jar version.

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-search-orm</artifactId>
    <version>5.6.1.Final</version>

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.