javahibernatehibernate-searchnomethoderror

attempting to get data from indexed table produces -java.lang.NoSuchMethodError: org.hibernate.query.internal.ParameterMetadataImpl


I am attempting to retrieve data from hibernate search, after indexing the table and I attempt to make a search I get this error even when everything looks perfect to me. I have googled and found this solution How to fix "NoSuchMethodError ParameterMetadataImpl <init> but still did not provide a headway to solving the problem- java.lang.NoSuchMethodError: org.hibernate.query.internal.ParameterMetadataImpl.([Lorg/hibernate/engine/query/spi/OrdinalParameterDescriptor;Ljava/util/Map;)V

here is my complete pom.xml file

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

            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-entitymanager</artifactId>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator</artifactId>
            </dependency>

            <dependency>
                <groupId>org.projectlombok</groupId>
                <artifactId>lombok</artifactId>
                <optional>true</optional>
            </dependency>

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


</project>

kindly assist


Solution

  • The version of Hibernate Search you're using is simply too old, and not compatible with the version of Hibernate ORM provided by Spring Boot.

    You should check the compatibility matrix on the Hibernate website and pick the Hibernate Search version accordingly.

    Spring Boot 2.1.4.RELEASE uses Hibernate ORM 5.3.9.Final. According to the compatibility matrix, with Hibernate ORM 5.3.x, you should use Hibernate Search 5.10.x. As indicated here, the latest release in the 5.10 series is currently 5.10.9.Final.

    So, change this:

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

    To this:

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