1,适配不同的数据库,支持其特有的数据类型,如对于Oracle解决方案:
IDatabaseConnection connection = new DatabaseConnection(jdbcConnection, schema);2,对于FlatXml,导入时可能丢失某些字段,解决方案:
DatabaseConfig config = connection.getConfig();
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new OracleDataTypeFactory());
FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();3,对于导出多表时,表之间的有外键关系,解决方案:
builder.setColumnSensing(true);
IDataSet dataSet = builder.build(new File("src/xml/flatXmlTableTest.xml"));
IDatabaseConnection conn = new DatabaseConnection(jdbcConn);
ITableFilter filter = new DatabaseSequenceFilter(conn);
IDataSet dataset = new FilteredDataSet(filter, conn.createDataSet());
FlatXmlDataSet.write(dataset, new File(fileName));