DdlUtils:推迟插入
为了将数据库从 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从 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
应该是:
should be: