DBunit and dataset column

梦想的初衷 提交于 2019-12-12 05:57:57

问题


I want to try to make unit test with DBUnit but I have a problem with my dataset.

Here is my persistence object:

@Entity
@Table(name = "personnes")
public class Personne implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Integer pk;

    @Column
    private String name;
}

And my dataset:

<?xml version='1.0' encoding='UTF-8'?>
<dataset>
    <personnes name="toto"  pk="1" />
</dataset>

My problem is with the name column, I get this error:

org.dbunit.dataset.NoSuchColumnException: personnes.NAME -  (Non-uppercase input column: name) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.

I don't understand why dbunit search a column "NAME" whereas my column is "name".

Thanks for your help.


回答1:


I just solved this issue by reverting dbunit from version 2.4.8 to 2.2.2. I'm using it with unitils 3.8.




回答2:


It is possible that your JPA vendor adapter is creating column names in UPPER CASE only. You could define column names implicitly with Column annotation.



来源:https://stackoverflow.com/questions/5692834/dbunit-and-dataset-column

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