DBUnit dataset export by set of primary key
Asked Answered
F

1

5

I tried to export a dataset from an oracle database by a set of primery keys using:

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. ¿I think this is a bug of DBUnit, anyone knows a solution to this aproach?

Fraase answered 15/10, 2010 at 16:52 Comment(1)
You expected that only the reference to the table would be exported, instead of the whole table? Do you have a foreign key that depends on that table?Assignor
J
7

In the past I have successfully used Jailer (http://jailer.sourceforge.net/) to extract datasets compatible with 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 can export datasets in the XML compatible DBUnit format. 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).

Julianejuliann answered 13/12, 2010 at 9:32 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.