org.dbunit.dataset.NoSuchTableException,但表存在

时间:2016-03-03 16:23:38

标签: java sql junit h2 dbunit

H2 1.4.191。
DbUnit 2.5.1。
如何解决这个问题?
3个案例的代码和结果:

    g.fillRect(width/10 - 2, height/2 - 10, 4, 20);
    g.fillRect(9*width/10 - 2, height/2 - 10, 4, 20);

    g.drawLine(width/10, height/2, (int) (width/2 - (sCoefficientH * s)), height/2);
    g.fillOval((int) (width/2 - (sCoefficientH * s)) -5, height/2 - 5, 10, 10);

1 个答案:

答案 0 :(得分:2)

有时当您使用dbunit时,您需要定义尝试使用该表的模式,可能您可以尝试添加

<dataset>
<schema.Category categoryId="9223372036854775806"
      categoryName="NAME"
      categoryParentId="9223372036854775805"/>   
</dataset>

如果没有检查您正在使用的数据源,可能您没有指向正确的数据库或架构。

对于dbunit,我们有一些properties考虑​​使用Qualified table names属性,如下所示。

DatabaseConfig dBConfig = dBConn.getConfig(); // dBConn is a IDatabaseConnection
dBConfig.setProperty(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, true);