Sring Boot 3 中的 Hibernate 搜索和 Hibernate 核心兼容性问题

问题描述 投票:0回答:1

我正在使用 spring boot v

3.1.2
spring-boot-starter-data-jpa

添加 Hibernate Search 依赖项后,出现以下错误

<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-search-orm</artifactId>
    <version>5.8.2.Final</version>
</dependency>
***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    org.hibernate.search.cfg.impl.SearchConfigurationFromHibernateCore.<init>(SearchConfigurationFromHibernateCore.java:80)

The following method did not exist:

    'org.hibernate.MultiTenancyStrategy org.hibernate.boot.spi.SessionFactoryOptions.getMultiTenancyStrategy()'

The calling method's class, org.hibernate.search.cfg.impl.SearchConfigurationFromHibernateCore, was loaded from the following location:

    jar:file:/Users/smaillns/.m2/repository/org/hibernate/hibernate-search-orm/5.8.2.Final/hibernate-search-orm-5.8.2.Final.jar!/org/hibernate/search/cfg/impl/SearchConfigurationFromHibernateCore.class

The called method's class, org.hibernate.boot.spi.SessionFactoryOptions, is available from the following locations:

    jar:file:/Users/smaillns/.m2/repository/org/hibernate/orm/hibernate-core/6.2.6.Final/hibernate-core-6.2.6.Final.jar!/org/hibernate/boot/spi/SessionFactoryOptions.class
    jar:file:/Users/smaillns/.m2/repository/org/hibernate/hibernate-core/5.2.11.Final/hibernate-core-5.2.11.Final.jar!/org/hibernate/boot/spi/SessionFactoryOptions.class

The called method's class hierarchy was loaded from the following locations:

    org.hibernate.boot.spi.SessionFactoryOptions: file:/Users/smaillns/.m2/repository/org/hibernate/orm/hibernate-core/6.2.6.Final/hibernate-core-6.2.6.Final.jar


Action:

Correct the classpath of your application so that it contains compatible versions of the classes org.hibernate.search.cfg.impl.SearchConfigurationFromHibernateCore and org.hibernate.boot.spi.SessionFactoryOptions

spring-boot hibernate hibernate-search
1个回答
0
投票

springboot-starter-jpa 3.1.2 的 Hibernate ORM 版本是 6.2.6.Final。 并且您的 hibernate search 版本 5.8 与 Hibernate ORM 6 不兼容。

参考Hibernate Search 6.2的兼容性,您将需要

<dependency>
    <groupId>org.hibernate.search</groupId>
    <artifactId>hibernate-search-mapper-orm-orm6</artifactId>
    <version>6.2.3.Final</version>
</dependency>

兼容 Hibernate ORM 6。

由于这是一个重大版本更改,您可能需要参考 Hibernate 搜索迁移指南了解详细信息。

© www.soinside.com 2019 - 2024. All rights reserved.