DdlUtils:推迟插入

发布于 2024-11-17 08:27:07 字数 526 浏览 3 评论 0原文

为了将数据库从 oracle 迁移到 mysql,我使用 ddlutils。迁移架构适合我的目的,但插入数据由于缺少行而失败。以下日志文​​件摘录对其进行了解释:

[ddlToDatabase] About to execute SQL: INSERT INTO `RECORDSTATUS` (`NAME_ID`, RECORDSTATUS_ID`, `NAME`, `SORTVALUE`) VALUES (?, ?, ?, ?)
[ddlToDatabase] Inserted bean RECORDSTATUS:RECORDSTATUS_ID=0
...
[ddlToDatabase] Defering insertion of row NAME:LANGUAGE_ID=0;NAME_ID=5941 because it is waiting for:
[ddlToDatabase]   RECORDSTATUS:RECORDSTATUS_ID=0

在数据库中,有一行 RECORDSTATUS_ID=0。有人遇到同样的问题吗?有人有想法吗,问题是什么?

in order to migrate a db from oracle to mysql i am using ddlutils. Migrating the schema works for my purposes, but inserting the data fails due to missing rows. The following excerpt from the log file explains it:

[ddlToDatabase] About to execute SQL: INSERT INTO `RECORDSTATUS` (`NAME_ID`, RECORDSTATUS_ID`, `NAME`, `SORTVALUE`) VALUES (?, ?, ?, ?)
[ddlToDatabase] Inserted bean RECORDSTATUS:RECORDSTATUS_ID=0
...
[ddlToDatabase] Defering insertion of row NAME:LANGUAGE_ID=0;NAME_ID=5941 because it is waiting for:
[ddlToDatabase]   RECORDSTATUS:RECORDSTATUS_ID=0

In the database, there is a row RECORDSTATUS_ID=0. Did anybody face the same issue? Has somebody an idea, what the problem is?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倒带 2024-11-24 08:27:07

从 MySql 迁移到 DerbyDB 时我遇到了类似的问题。就我而言,实际问题是 DDLUtils 仅处理那些针对主键的外键。

因此,如果您有包含某些唯一非主键字段的 MASTER 表,并且有引用(外键)该唯一非主键字段的 DETAILS 表,则 DDLUtils 无法将 DETAILS 记录链接到 MASTER,因此根本无法插入 DETAIL 记录。

这是 DDLUtils 1.0 版本中的情况。

我对代码做了一些快速(可能是肮脏的)修改,它似乎解决了这个问题。修改后的版本可以在这里下载(包括源代码):DllUtils-1.0_mod_with_src.jar。您可以自行承担使用它的风险。

此致
卡里·苏拉卡

I had similar problem when migrating from MySql to DerbyDB. I my case the actual problem was that DDLUtils handles only those foreign keys that are targetted to primary keys.

So, if you have MASTER table that contains some unique non primary key field, and you have DETAILS table that references (foreign key) to that unique non primary key field, DDLUtils cannot link DETAILS records to MASTER and cannot therefore insert DETAIL records at all.

This was the situation in DDLUtils version 1.0.

I made some quick (and mayby dirty) modifications to code and it seems to solve this problem. Modified version can be downloaded here (includes source): DllUtils-1.0_mod_with_src.jar. You can use it at you own risk.

Best regards
Kari Surakka

找个人就嫁了吧 2024-11-24 08:27:07
INSERT INTO `RECORDSTATUS` (`NAME_ID`, RECORDSTATUS_ID`, `NAME`, `SORTVALUE`) VALUES 

应该是:

INSERT INTO `RECORDSTATUS` (`NAME_ID`, `RECORDSTATUS_ID`, `NAME`, `SORTVALUE`) VALUES 
INSERT INTO `RECORDSTATUS` (`NAME_ID`, RECORDSTATUS_ID`, `NAME`, `SORTVALUE`) VALUES 

should be:

INSERT INTO `RECORDSTATUS` (`NAME_ID`, `RECORDSTATUS_ID`, `NAME`, `SORTVALUE`) VALUES 
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文