开发者

Does DBUnit DatabaseSequenceFilter work for MySQL?

I'm dumping the whole contents of my MySQL database to file with DBUnit, and getting MySQLIntegrityConstraintViolationException: Cannot delete or update a parent row: a foreign key constraint fails ... when reading back in.

The tables are being written in alphabetical order, even though I use the DatabaseSequenceFilter to reorder them by dependency.

filter = new DatabaseSequenceFilter(connection);
dataset = new FilteredDataSet(filter, connection.createDataSet());
FlatXmlDataSet.write(dataset, w)

The database clearly has the foreign key constraints specified (I can see them, and they wouldn't fail on import if they we开发者_运维百科ren't there).

Has anyone seen DatabaseSequenceFilter working for MySQL?


Debug to see which query produced this exception. Connect to db and check which constraint it is about. Show example log, it will be easier to help.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜