
Some parts of this message have been removed.
Learn more about Nabble's
security policy.
Hello,
I’m trying to create a dataset of my
database with the help of the extracting features offered by dbUnit.
I used QueryDataSet as described in the FAQ
(http://www.dbunit.org/faq.html#extract)
with a limited SELECT, which worked well.
But now I want to create a dataset with
dependent tables. dbUnit offers the method TablesDependencyHelper.getAllDependentTables
which also works well.
Because I have a huge database (Oracle), I
want to limit the data output.
My idea was to get the dependent dataset,
filter it and then write it to the xml file. I tried the following:
String[] depTableNames = TablesDependencyHelper.getAllDependentTables(
connection, "MYSCHEMA.MYTABLE" );
IDataSet depDataSet =
connection.createDataSet( depTableNames );
HashSet<Integer> allowedPrimaryKeys =
new HashSet<Integer>();
allowedPrimaryKeys.add(200223);
allowedPrimaryKeys.add(200001);
HashMap<String,
HashSet<Integer>> allowedPrimaryKeysMap = new HashMap<String,
HashSet<Integer>>();
allowedPrimaryKeysMap.put("MYSCHEMA.MYTABLE",
allowedPrimaryKeys);
PrimaryKeyFilter primaryKeyFilter = new
PrimaryKeyFilter(connection, allowedPrimaryKeysMap, true);
FilteredDataSet filteredDataSet = new
FilteredDataSet(primaryKeyFilter, depDataSet);
FlatXmlDataSet.write(filteredDataSet, new
FileOutputStream("dependents.xml"));
But it just exports the complete
MYSCHEMA.MYTABLE.
I found no code examples how
PrimaryKeyFilter is used.
Any ideas?
Philipp
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php_______________________________________________
dbunit-user mailing list
dbunit-user@...
https://lists.sourceforge.net/lists/listinfo/dbunit-user