Search code examples
spring-bootdbunitmariadb-10.3

DBRider: org.dbunit.database.AmbiguousTableNameException


I've migrated to Spring Boot 3, MariaDB 10.3 and DbRider 1.35.0 and I'm trying to run tests and I'm getting this weird error

  @SpringBootTest(classes = { HibernateTestConfig.class, DaoTest_List_DBUnitConfig.class })
  @DBRider(dataSourceBeanName = "dbUnitDataSource")
  @DBUnit(schema = "test", qualifiedTableNames = true)
  @DataSet(CommonDbDomainUtils.DATA_TEST_FILE)
  public class XXXTest_List_DBUnit {
  
  }

I'm getting this error...

  Caused by: org.dbunit.database.AmbiguousTableNameException: XXX
      at org.dbunit.dataset.OrderedTableNameMap.add(OrderedTableNameMap.java:198)
      at org.dbunit.database.DatabaseDataSet.initialize(DatabaseDataSet.java:244)

The data is setup in a XML file. The setup was working just fine with Springboot 2.6 and DbRider 1.13.1

I've tried:

setting the schema using qualifiedTableNames setting the data in the config, so it only runs once (if you can tell me how to run the data setup only once, it will be also appreciated)


Solution

  • There were 2 issues for me... One, my schema had a '-', so I changed it to 'test'... Second I need to specify a bunch of new config... including 2 classes to help read the metadata...

    @DBUnit(schema = "test", qualifiedTableNames=true, dataTypeFactoryClass = MySqlDataTypeFactory.class, metaDataHandler= MySqlMetadataHandler.class )