# Spring 运行的时候提示数据库方言错误

**URL:** <https://www.isharkfly.com/t/spring/18469>\
**Category:** 程序语言\
**Tags:** java, spring\
**Created:** [November 21, 2025, 7:46pm UTC](https://www.isharkfly.com/t/spring/18469 "2025-11-21T19:46:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [November 21, 2025, 7:46pm UTC](https://www.isharkfly.com/t/spring/18469/1 "2025-11-21T19:46:48Z")

</div>

```auto
aused by: java.lang.ClassNotFoundException: org.hibernate.dialect.PostgreSQL82Dialect

```

 ![2025-11-21_14-44-58](https://cdn.isharkfly.com/com-isharkfly-www/discourse-uploads/original/3X/8/5/8532288df8d1084e0563c3b93e23af2549a00d8a.png)

## 问题和解决

上面的问题不是因为数据库配置的问题导致的。

而是在 pom 文件中。

```auto
        <!-- hibernate enhancement -->
        <dependency>
            <groupId>com.vladmihalcea</groupId>
            <artifactId>hibernate-types-55</artifactId>
            <version>2.21.1</version>
        </dependency>

```

在 Spring 3 的版本中，Hibernate 已经开始使用 6 的版本。

hibernate-types-55 这个会导致数据类型的问题。

所以应该使用：

```auto
        <!-- hibernate enhancement -->
        <dependency>
            <groupId>com.vladmihalcea</groupId>
            <artifactId>hibernate-types-60</artifactId>
            <version>2.21.1</version>
        </dependency>

```

这个版本才可以。

---

<div class="post-metadata">

**Author:** ![scott01](https://www.isharkfly.com/letter_avatar_proxy/v4/letter/s/85e7bf/32.png) [@scott01](https://www.isharkfly.com/u/scott01)\
**Post date:** [February 2, 2026, 1:42pm UTC](https://www.isharkfly.com/t/spring/18469/2 "2026-02-02T13:42:18Z")

</div>

Yes, this is a classic case of Spring and Hibernate not working together, not a Postgres problem. Hibernate 6 is now used by Spring Boot 3, and PostgreSQL82Dialect is no longer there. When you pull in hibernate-types-55, it brings Hibernate 5 assumptions into a Hibernate 6 runtime. This causes a ClassNotFoundException.

The right fix is to switch to hibernate-types-60. If you’re having this problem, also check spring.jpa.database-platform. With modern Spring Boot and PostgreSQL, you usually don’t even need to set a dialect. Hibernate will find it on its own.

In short, all extensions must work with Spring Boot 3 and Hibernate 6. combining There will always be bad things that happen with 5.x artifacts.
