org.dbunit.dataset.NoSuchTableException: Did not find table 'xxx' in schema 'null'

后端 未结 7 630
没有蜡笔的小新
没有蜡笔的小新 2020-12-06 06:46

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.

I have set up hibernate and spring.

7条回答
  •  暖寄归人
    2020-12-06 07:15

    remove the first line in your dataset.xml file

    and replace it with this

    otherwise DBUnit tries to load the db tables schema from a DTD file and if no DTD is provided it will never match on any tables. Using the plain xml header will cause DBUnit to skip this DTD - table check that is throwing the error you see.

    You must also do what Grzegorz did and have hibernate do a create-drop for your tables by including

    or

    configuration.setProperty(Environment.HBM2DDL_AUTO, "create-drop");

提交回复
热议问题