1

Does anyone know if dbunit has the power to export specific data from multiple tables at once based on a sql statement, as can be done by using dbunit's QueryDataSet class to export data from a single table based on a sql statement, as can been seen here.

James

4

2 回答 2

5

http://jailer.sourceforge.net/

于 2008-12-17T18:58:31.260 回答
0

是的,它可以。您只需调用 addTable(...) 方法将数据收集到 QueryDataSet 并通过 FlatXmlDataSet.write(...) 导出

QueryDataSet partialDataSet = new QueryDataSet(connection);
partialDataSet.addTable(tableName1, "select * from " + tableName1);
partialDataSet.addTable(tableName2, "select * from " + tableName2);
partialDataSet.addTable(tableName3, "select * from " + tableName3);

FileOutputStream fos = new FileOutputStream("Noname.dataset");
FlatXmlDataSet.write(ratingDataSet, fos);
于 2017-12-26T12:45:34.610 回答