WriteDataToDatabaseCommand wdtd = new WriteDataToDatabaseCommand();
wdtd.setFailOnError(true);
wdtd.setDataFile(a);
wdtd.setEnsureForeignKeyOrder(true);
wdtd.setUseBatchMode(true);
wdtd.setBatchSize(100);
//Build task
DatabaseToDdlTask in = new DatabaseToDdlTask();
in.setUseDelimitedSqlIdentifiers(true);
in.addConfiguredDatabase(dcs.convertToBasicDataSource(destds));
in.addWriteDataToDatabase(wdtd);
in.execute();

Notice Im using the DatabaseToDdl task instead of the DdlToDatabase task,
except I'm loading data into the database from a previously generated xml.
If I try it from the DdlToDatabase task, I get

No database model specified
   at org.apache.ddlutils.task.DatabaseTaskBase.executeCommands(
DatabaseTaskBase.java:212)
   at org.apache.ddlutils.task.DatabaseTaskBase.execute(
DatabaseTaskBase.java:242)
   at com.creative.db.DatabaseTest.readFromDatabase(DatabaseTest.java:109)
   at com.creative.db.DatabaseCopy.main(DatabaseCopy.java:15)

Since that does that, I think it's causing the IDENTITY_INSERT feature to
not work.


--
Obs

Reply via email to