I have a table that I am trying to load with data that includes different columns. It appears that dbUnit gets confused and tries to load the data using previously used column names.
The data for table t_setting in the snapshot is as follows:
<t_setting hid="162" id="RssUrl" source="2" fk_to_settingdefinition="157" fk_to_widgetdef="159" setting_position="1"/>
<t_setting hid="218" id="scan1_Preview" fk_to_settingdefinition="110" fk_to_task="217"/>
You'll see that the first row sets data in fk_to_widgetdef - the 2nd in fk_to_task.
However, the sql generated (from P6Spy) is:
1231189497656|31|1|statement|insert into t_setting (hid, id, source, fk_to_settingdefinition, fk_to_widgetdef, setting_position) values (?, ?, ?, ?, ?, ?)|insert into t_setting (hid, id, source, fk_to_settingdefinition, fk_to_widgetdef, setting_position) values (162, 'RssUrl', 2, 157, 159, 1)
1231189497656|0|1|statement|insert into t_setting (hid, id, source, fk_to_settingdefinition, fk_to_widgetdef, setting_position) values (?, ?, ?, ?, ?, ?)|insert into t_setting (hid, id, source, fk_to_settingdefinition, fk_to_widgetdef, setting_position) values (218, 'scan1_Preview', '', 110, '', '')
dbUnit does not try to insert into fk_to_task in the 2nd statement, but rather into fk_to_widgetdef again.
cheers,
David
NOTE: this is against version 2.1. I tries to upgrade to latest version, but couldn't get it to run with maven.
Never mind - just realised that it's the old missing column issue.
Never mind - just realised that it's the old missing column issue.
Hi David,
dbunit works as designed here. If you have a look at The FlatXmlDataSet docs ( http://dbunit.sourceforge.net/components.html ) you can read the that Column definition is deduced from the _first_ row in the XML. It is also described there how you can fix this (use a DTD or switch columnSensing=true).
I will close this bug report.
Best regards,
matthias