java - 将 Spring boot JPA(MySQL) 迁移到 JPA(PostgreSQL) 会引发错误
问题描述
我有一个带有 JPA 的 Spring Boot Web 应用程序,数据库是 MySQL。我必须从 MySQL DB 迁移到 PostgreSQL。在将 PostgreSQL 配置为应用程序时,某些表(实体)会导致错误。
JPA 的“创建”选项工作正常。但是当将创建更改为“更新”时,程序会因错误而终止。
错误是
'列 i.indproc 不存在 提示:也许您的意思是引用列“i.indpred”。位置:610'
ERROR 31134 --- [ restartedMain] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory'.....
[PersistenceUnit: default] Unable to build Hibernate SessionFactory
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory
n.SQLGrammarException: Error accessing index information: table_user
Caused by: org.postgresql.util.PSQLException: ERROR: column i.indproc does not exist
解决方案
我遇到了类似的错误。将 postgreql maven 依赖项升级到最新版本修复了我的错误。2019 年 8 月,
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.6</version>
</dependency>
推荐阅读
- angular - Nativescript 'Image' 不是已知元素
- python - 熊猫一旦在列中满足条件删除 n 行然后转到下一部分
- python - 在python中制作多个数据帧的列表以在迭代中使用
- python - Python 开源视频播放器动态播放连续视频流
- ios - 地图视图在方向更改时崩溃
- broadcast - 为 TPOT 运行数据集时出现 tpot 错误消息
- npm - 找出 npm dedupe 无限挂起的原因
- node.js - 在异步应用程序中定义解析/拒绝的正确方法是什么
- javascript - 根据逾期天数发出警报的基本 Netsuite 客户端脚本
- c - 在同一个源上多次运行 C 预处理器是否安全?