I have here a curios problem with DBUnit. I want to try insert a new table entry via a dataset XML:
<?xml version='1.0' encoding='UTF-8'?>
<dataset>
<MyTable ID="1" OtherID="34588" Count="15" Value="20.0" />
</dataset>
But I get the following exception:
org.dbunit.DatabaseUnitException: Exception processing table name='MyTable'
at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:216)
at org.dbunit.ext.mssql.InsertIdentityOperation.execute(InsertIdentityOperation.java:217)
at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
at org.dbunit.AbstractDatabaseTester.executeOperation(AbstractDatabaseTester.java:190)
at org.dbunit.AbstractDatabaseTester.onSetup(AbstractDatabaseTester.java:103)
at org.dbunit.DatabaseTestCase.setUp(DatabaseTestCase.java:156)
...
Curios is that the new entry was added in the table successfully (if I do a select I can see the new added entry).
The question is why I get the exception...
What's happen is following:
For the table "MyTable" was defined also a Trigger Routine. The Trigger was also finished without any problems. But the Trigger is calling a Stored Procedure. And this Stored Procedure executes a SELECT and Returns the result as a ResultSet. And this returned ResultSet is the problem. Seems that DBUnit has problems if a Insert Trigger returns a ResultSet ...
After remove the select/ResultSet all runs as expected ... :-)