DBunit; confusion over case sensitivity on table/column names

Jimmy picture Jimmy · Feb 5, 2010 · Viewed 16k times · Source

I'm getting this error when I start up my application

Caused by: org.dbunit.dataset.NoSuchColumnException: CLIENT.ID -  (Non-uppercase input column: ID) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive

I'm not too sure why I'm getting this, since my table/column names all all referenced in upper case(even though the message insists this shouldn't be an issue)

My table :

mysql> describe CLIENT;
+------------------+--------------+------+-----+---------+----------------+
| Field            | Type         | Null | Key | Default | Extra          |
+------------------+--------------+------+-----+---------+----------------+
| ID               | int(11)      | NO   | PRI | NULL    | auto_increment |
| jdoDetachedState | tinyblob     | YES  |     | NULL    |                |
| NAME             | varchar(255) | NO   |     | NULL    |                |
| ADDRESS1         | varchar(255) | YES  |     | NULL    |                |
| ADDRESS2         | varchar(255) | YES  |     | NULL    |                |
| COUNTRY          | varchar(255) | YES  |     | NULL    |                |
| COUNTY           | varchar(255) | YES  |     | NULL    |                |
| MAINPHONENUMBER  | varchar(255) | YES  |     | NULL    |                |
| POSTCODE         | varchar(255) | YES  |     | NULL    |                |
| SECTOR           | varchar(255) | YES  |     | NULL    |                |
| TOWN             | varchar(255) | YES  |     | NULL    |                |
| WEBSITEURL       | varchar(255) | YES  |     | NULL    |                |
+------------------+--------------+------+-----+---------+----------------+
12 rows in set (0.00 sec)

mysql> 

Snippet of my domain entity :

@Id
@GeneratedValue
@Column(name="ID")
private Integer id;

Snippet of test date I'm trying to force DBUnit to use:

<dataset>
  <CLIENT ID="-1"
    ADDRESS1="Endeavour House"
    ADDRESS2="Russell Rd"
    COUNTRY="England"
    COUNTY="Suffolk"
    MAINPHONENUMBER="0845 606 6067"
    NAME="Suffolk County Council"
    POSTCODE="IP1 2BX"
    SECTOR="Local Government"
    TOWN="Ipswich"
    WEBSITEURL="www.suffolk.gov.uk"/>
</dataset>

I can't think of anything else to try, have dropped tables and recompiled java code, any ideas?

Answer

amorfis picture amorfis · Feb 5, 2010

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