DBunit; confusion over case sensitivity on table/column names

雨燕双飞 提交于 2019-12-01 07:08:25

Aren't you trying to put to database Client with ID already set? ID column is read-only, only database can "write" to it.

I've also had this problem after adding a column to one of my entities (using an in-memory HSQL database).

I managed to solve this problem by simply deleting the temporary files that had previously been generated: mem:testdb.log, mem:testdb.properties and mem:testdb.script

Why did this error occur? => A database schema is stored in the mem:testdb.script file and is not re-generated when the entity is modified.

I have fixed the error by adding the mentioned column to my entity.

Bilbo Baggins

I ran into the same error, fortunately we had some other test written earlier and found that in most of the tutorials the format the way the xml is written is for the FlatXMLDataSet if you are using XML data set then the correct version is as follow checkout the link at the bottom for more information.

it should be in following format.

<?xml version="1.0" encoding="UTF-8"?>
<dataset>
    <table>
        <column>id</column>
        <column>name</column>
        <column>department</column>
        <column>startDate</column>
        <column>endDate</column>
        <row>
            <value>999</value>
            <value>TEMP</value>
            <value>TEMP DEPT</value>
            <value>2113-10-13</value>
            <value>2123-10-13</value>
        </row>
    </table>
</dataset>

For more information go to this link.

http://dbunit.sourceforge.net/components.html#FlatXmlDataSet

One more time I faced this error in another project, we have a hierarchy of model class, some how hibernate used to create a table Role with 7 columns but while running it with DBUnit it was unable to create the columns(Only 5 were created) hence it was throwing this error, Solution : Manually created this table and 3 more relationship tables which were not created by hibernate.

this error goes away with mysql and hsql if you make format = flat

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!