开发者

DdlUtils: defering insertion

开发者 https://www.devze.com 2023-03-15 11:58 出处:网络
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

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 e开发者_开发百科xecute 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?


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


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

should be:

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号