English 中文(简体)
亚洲开发银行可以找到数据集界定的表格。
原标题:DBunit can t find tables defined on dataset

我有一个数据集(在Xml中界定),一使用邮政GreSQL、POJO和JPA附加说明,二是同Junit共同测试的Db。

When the test runs, it creates the tables and sequences in the database, but when it starts to read the dataset (xml) with the table definitions and columns, it fires the following error org.dbunit.dataset.NoSuchTableException "nameoftable" I tried to put the name of the table with all caps and normal caps, and it won t work. The table was created in the public schema, and then i tried to define in the xml the table as public."nameoftable" but it also won t work.... any ideas?

我试图用以下版本与注射器一起进行这一测试:2.2.2, 2.3.0和2.4.5。

感谢。

问题回答

有了DBUnit,你可以使用特定图象进行测试,也可以使用完整的数据库(有多种图象)。 如果你使用后者,那么在进口/出口数据集中,或者在数据集中,需要具体说明该表;在邮政总局中,我至少没有尝试过。

在以下法典中加入:

if (strSchema == null || strSchema.isEmpty()) {
    conn = new DatabaseConnection(jdbcConnection);
    conn.getConfig().setProperty(
            "http://www.dbunit.org/features/qualifiedTableNames", true);
}
else
    conn = new DatabaseConnection(jdbcConnection, strSchema);

重要的轨道是财产的确定;其余部分是我用来使与非行或化chem相关联(根据从冲破的XML中抽取的化学名称)。





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签