Her*_*i.R 3 postgresql spring hibernate dialect entitymanagerfactory
我正在将 Spring Boot 父版本从 2.5.12 迁移到3.0.6,我遇到了许多可以解决的问题,但我在这一问题上遇到了困难:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: org/hibernate/dialect/PostgreSQL82Dialect
Caused by: java.lang.NoClassDefFoundError: org/hibernate/dialect/PostgreSQL82Dialect
at com.vladmihalcea.hibernate.type.HibernateTypesContributor.contribute(HibernateTypesContributor.java:34)
at org.hibernate.boot.internal.MetadataBuilderImpl.applyTypes(MetadataBuilderImpl.java:296)
Run Code Online (Sandbox Code Playgroud)
我的 pom.xml (仅受影响的依赖项):
<!-- versions -->
<hibernate-core.version>6.2.5.Final</hibernate-core.version>
<hibernate-types.version>2.16.3</hibernate-types.version>
<postgresql.version>42.5.4</postgresql.version>
<spring.boot.version>3.0.6</spring.boot.version>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>${spring.boot.version}</version>
</dependency>
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-52</artifactId>
<version>${hibernate-types.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate-core.version}</version>
<scope>compile</scope>
</dependency>
Run Code Online (Sandbox Code Playgroud)
应用属性:
jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.PostgreSQLDialect
Run Code Online (Sandbox Code Playgroud)
java版本:17
小智 12
请注意,您仍在使用hibernate-types52
它指的是以前的主要 Hibernate 5+。您应该参考最新的hibernate-types60
依赖项来完全迁移到 hibernate 6+。截至目前,您可以使用以下内容:
<dependency>
<groupId>com.vladmihalcea</groupId>
<artifactId>hibernate-types-60</artifactId>
<version>2.21.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
2655 次 |
最近记录: |