简体   繁体   English

DBUnit数据集按主键集导出

[英]DBUnit dataset export by set of primary key

I tried to export a dataset from an oracle database by a set of primery keys using: 我尝试使用以下方法通过一组素数键从oracle数据库导出数据集:

TablesDependencyHelper.getDataset(connection, fullTableName , 
                    new TreeSet(Arrays.asList(
                        new BigDecimal[]{new BigDecimal(1)})));

That throws me a data file of 45mb!!!, checking the file I realize that the problem was a reference to a table with composite key(6 foreign keys), instead of exporting the unique referenced registry, it took the whole table data. 这会抛出一个45mb的数据文件!!!,检查文件我发现问题是对带有复合键(6个外键)的表的引用,而不是导出唯一引用的注册表,它占用了整个表数据。 ¿I think this is a bug of DBUnit, anyone knows a solution to this aproach? ¿我认为这是DBUnit的错误,任何人都知道这个方法的解决方案?

In the past I have successfully used Jailer ( http://jailer.sourceforge.net/ ) to extract datasets compatible with DBUnit. 在过去,我已成功使用Jailer( http://jailer.sourceforge.net/ )提取与DBUnit兼容的数据集。 Jailer has a GUI that allows you to select the tables you want to export and, more important, exclude from the final dataset specific tables. Jailer有一个GUI,允许您选择要导出的表,更重要的是,从最终数据集特定表中排除。 Jailer can export datasets in the XML compatible DBUnit format. Jailer可以以XML兼容的DBUnit格式导出数据集。 Only drawback of Jailer is the time it takes to initially parse the structure of your db - but only if you have a large, complex db). Jailer的唯一缺点是最初解析数据库结构所需的时间 - 但前提是你有一个庞大而复杂的数据库)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM