Reputation: 1176
H2 1.4.191.
DbUnit 2.5.1.
How this can be fixed?
Code and results for 3 cases:
org.dbunit.dataset.NoSuchTableException: category
org.dbunit.dataset.NoSuchTableException: Category
org.dbunit.dataset.NoSuchTableException: CATEGORY
//
<dataset>
<Category categoryId="9223372036854775806"
categoryName="NAME"
categoryParentId="9223372036854775805"/>
</dataset>
//
CREATE TABLE Category (
categoryId INT AUTO_INCREMENT,
categoryName VARCHAR NOT NULL,
categoryParentId INT NOT NULL,
PRIMARY KEY (categoryId)
)
//Check - tried to recreate
org.h2.jdbc.JdbcSQLException: Table "CATEGORY" already exists;
Upvotes: 3
Views: 6957
Reputation: 19533
Sometimes when you are using dbunit you need to define the schema from which you are trying to use the table, probably you could try to add
<dataset>
<schema.Category categoryId="9223372036854775806"
categoryName="NAME"
categoryParentId="9223372036854775805"/>
</dataset>
If not check the datasource that you are using, probably you are not pointing to the correct database or schema.
For dbunit we have some properties consider using the Qualified table names
property as follows.
DatabaseConfig dBConfig = dBConn.getConfig(); // dBConn is a IDatabaseConnection
dBConfig.setProperty(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, true);
Upvotes: 2