3

在 Jboss 服务器启动期间,我得到以下堆栈跟踪。我想知道为什么 JPA 试图改变看起来很好的表以及如何传递这些错误消息。谢谢

2009-08-03 11:28:49,683 错误 [org.hibernate.tool.hbm2ddl.SchemaUpdate] 不成功:更改表 BDPARAMS 添加约束 FK61733C48FA34BFDC 外键 (ITEMID) 引用 RTELEMENT 2009-08-03 11:28:49,683 错误 [org .hibernate.tool.hbm2ddl.SchemaUpdate] 不成功:更改表 BDPARAMS 添加约束 FK61733C48FA34BFDC 外键 (ITEMID) 引用 RTELEMENT 2009-08-03 11:28:49,683 错误 [org.hibernate.tool.hbm2ddl.SchemaUpdate] ORA-02275:表中已经存在这样的引用约束

2009-08-03 11:28:49,683 错误 [org.hibernate.tool.hbm2ddl.SchemaUpdate] ORA-02275:表中已存在此类引用约束

2009-08-03 11:28:49,745 错误 [org.hibernate.tool.hbm2ddl.SchemaUpdate] 不成功:更改表内容添加约束 FK692B5EEC44F32395 外键(父 ID)引用内容 2009-08-03 11:28:49,745 错误 [org .hibernate.tool.hbm2ddl.SchemaUpdate] 不成功:更改表内容添加约束 FK692B5EEC44F32395 外键(父 ID)引用内容 2009-08-03 11:28:49,745 错误 [org.hibernate.tool.hbm2ddl.SchemaUpdate] ORA-02275:表中已经存在这样的引用约束

4

4 回答 4

4

就我而言,当我将default_schema 名称添加到 Hibernate 配置文件时,问题就解决了:

<property name="hibernate.default_schema" value="db_default_schema_name" />

具体来说,在 Play framework 2.4 中,我将上述行添加到conf\META-INF\persistence.xml文件中。

使用的休眠版本:4.3.11

于 2016-07-20T13:22:15.933 回答
1

I've had similar errors and the problems stem from inaccuracies in the meta data fetch by the jdbc sub-system. The meta data comes back to tell hibernate the constraint is not there but in reality it is not - could be for a number of reasons. I would suggest trying a different dbms also maybe the issue is due user differences between current and user that generated the table. There could also be something wrong with your mapping.

But ultimately the only fool proof way to fix it is to turn off schema sync on startup.

于 2009-08-28T12:05:11.343 回答
1

我有同样的错误,但通过几个简单的步骤修复了它。

转储当前数据库 Mysqldump out current.sql 更改 hibernate.cfg 以创建,以便重新创建数据库表 转储新数据库 Mysqldump out new.sql

将create table new 复制到current.sql 中的当前重新插入数据库mysql

于 2011-09-28T08:30:50.023 回答
1

在我的情况下,在我更改项目中的 java 包结构后出现错误消息。我认为hibernate对此有点困惑。

我有类似的错误(更改表...添加约束),我正在使用 Oracle DB 10g。对我来说,最简单的解决方案是导出相关表(插入)的数据,删除它们,再次启动创建表的应用程序,然后再次导入表数据。然后 Hibernate 自己再次创建表,错误消息消失了!

于 2011-02-17T09:19:06.837 回答