title: org.dbunit.dataset.NoSuchTableException: Did not find table 'xxx' in schema 'null'
body: <p>I know there have been discussions wrt to dbunit here. I have read most of them but I cant seem to find a solution to my problem.</p>
  
  <p>I have set up hibernate and spring. I am doing TDD so I had to wire up a proper DAO testing framework before writing code. Dbunit came to mind and I got to setting it up. Here is ma testdataset.xml</p>
  
  <pre><code>    &lt;?xml version='1.0' encoding='UTF-8'?&gt;
      &lt;dataset&gt;
          &lt;table name="status"&gt;
              &lt;column&gt;statusId&lt;/column&gt;
              &lt;column&gt;status&lt;/column&gt;
              &lt;row&gt;
                  &lt;value&gt;0&lt;/value&gt;
                  &lt;value&gt;Available&lt;/value&gt;
              &lt;/row&gt;
          &lt;/table&gt;
          &lt;table name="user"&gt;
              &lt;column&gt;userId&lt;/column&gt;
              &lt;column&gt;firstName&lt;/column&gt;
              &lt;column&gt;lastName&lt;/column&gt;
              &lt;column&gt;username&lt;/column&gt;
              &lt;column&gt;password&lt;/column&gt;
              &lt;column&gt;email&lt;/column&gt;
              &lt;row&gt;
                  &lt;value&gt;0&lt;/value&gt;
                  &lt;value&gt;system&lt;/value&gt;
                  &lt;value&gt;admin&lt;/value&gt;
                  &lt;value&gt;admin&lt;/value&gt;
                  &lt;value&gt;admin&lt;/value&gt;
                  &lt;value&gt;admin@ccbs.com&lt;/value&gt;
              &lt;/row&gt;
          &lt;/table&gt;
          &lt;table name="reservation"&gt;
              &lt;column&gt;reservationId&lt;/column&gt;
              &lt;column&gt;userId&lt;/column&gt;
              &lt;column&gt;reservationDate&lt;/column&gt;
              &lt;column&gt;startDate&lt;/column&gt;
              &lt;column&gt;endDate&lt;/column&gt;
              &lt;column&gt;statusId&lt;/column&gt;
              &lt;row&gt;
                  &lt;value&gt;0&lt;/value&gt;
                  &lt;value&gt;0&lt;/value&gt;
                  &lt;value&gt;2011-02-20 12:46:00.0&lt;/value&gt;
                  &lt;value&gt;2011-03-01 12:00:00.0&lt;/value&gt;
                  &lt;value&gt;2011-04-01 12:00:00.0&lt;/value&gt;
                  &lt;value&gt;0&lt;/value&gt;
              &lt;/row&gt;
          &lt;/table&gt;
      &lt;/dataset&gt;
  </code></pre>
  
  <p>All seems well until i try to wire up some code using a base class that loads the dataset. Here is my code:</p>
  
  <pre><code>@Transactional
  @RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations = { "classpath:test-applicationContext.xml" })
  @TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
  public class BaseContextSensitiveTest {
  
      @BeforeClass
  public static void setUpDatabase() throws Exception {
      URL file = getInitalDatasetURL();
      testDataset = createDataset(file);
  }
  
     @Before
  public void init() throws Exception {
      log.info("Initializing Data Set");
      connection = createDBUnitConnection();
  
      DatabaseOperation.CLEAN_INSERT.execute(connection, testDataset);
  }
  
  private static URL getInitalDatasetURL() throws FileNotFoundException {
      URL file = ClassLoader.getSystemResource(TEST_DATASET_LOCATION);
      if (file == null) {
          throw new FileNotFoundException("Unable to find '"
                  + TEST_DATASET_LOCATION + "' in the classpath");
      }
      return file;
  }
  
  private static IDataSet createDataset(URL file) throws IOException,
          DataSetException {
  
      return new XmlDataSet(file.openStream());
  }
  
  private IDatabaseConnection createDBUnitConnection()
          throws DatabaseUnitException, SQLException {
  
      Connection connection = getConnection();
      IDatabaseConnection dbUnitConn = new DatabaseConnection(connection);
  
      // use the hsql datatypefactory so that boolean properties work
      // correctly
      DatabaseConfig config = dbUnitConn.getConfig();
      config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY,
              new HsqldbDataTypeFactory());
  
      return dbUnitConn;
  }
  </code></pre>
  
  <p>As soon as it hits the <code>DatabaseOperation.CLEAN_INSERT.execute(connection, testDataset);</code> it throws the following exception:</p>
  
  <pre><code>org.dbunit.dataset.NoSuchTableException: Did not find table 'USER' in schema 'null'
  at org.dbunit.database.DatabaseTableMetaData.&lt;init&gt;(DatabaseTableMetaData.java:142)
  at org.dbunit.database.DatabaseDataSet.getTableMetaData(DatabaseDataSet.java:290)
  at org.dbunit.operation.DeleteAllOperation.execute(DeleteAllOperation.java:109)
  at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
  at com.cottage.test.BaseContextSensitiveTest.init(BaseContextSensitiveTest.java:64)
  </code></pre>
  
  <p>I have all the hibernate mapping files in place and the database is already set up with no data. Funny thing (or annoying thing depending on how you look at it) is that if I change the order of the tables in the dataset, the missingtableexception complains of another table... either user, reservation or status.</p>
  
  <p>Any suggestions on what I might be doing wrong?</p>