title: Testing JPA/Hibernate entities using DBUnit
body: <p>I've got some problems with some entities specifically with the use of JPA/Hibernate and DBUNIT. 
  I came across this error when i tried to build the project. </p>
  
  <pre><code>Tests run: 2, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.221 sec &lt;&lt;&lt; FAILURE!
  readDocumentById(com.bt.msm.ds.facade.DataServicesFacadeTest)  Time elapsed: 2.043 sec  &lt;&lt;&lt; ERROR!
  org.dbunit.dataset.NoSuchColumnException: CONTENTDOCUMENT.ID -  (Non-uppercase input column: ID) in ColumnNameToIndexes cache map. Note that the map's column names are NOT case sensitive.
      at org.dbunit.dataset.AbstractTableMetaData.getColumnIndex(AbstractTableMetaData.java:128)
      at org.dbunit.operation.AbstractOperation.getOperationMetaData(AbstractOperation.java:89)
      at org.dbunit.operation.AbstractBatchOperation.execute(AbstractBatchOperation.java:140)
      at org.dbunit.operation.CompositeOperation.execute(CompositeOperation.java:79)
  </code></pre>
  
  <p>The error disappears if the configuration properties are as follows</p>
  
  <pre><code>username : usera
  password : usera
  schema   : usera
  dbunit version : 2.4.2
  </code></pre>
  
  <p>The error occurs if the configuration properties are as follows</p>
  
  <pre><code>username : usera
  pasword : usera
  schema :  schemab
  dbunit version &gt; 2.4.2 (e.g. 2.4.4)
  </code></pre>
  
  <p>It looks like if the shema name is the same as the username and the dbunit version is 2.4.2 then it works. If the schema name is not the same as the username and the dbunit version is any version greater than 2.4.2 ( i tried 2.4.3 and 2.4.4) then the error occurs. </p>
  
  <p>Here are some details </p>
  
  <p>Table DDL</p>
  
  <pre><code>CREATE TABLE CONTENTDOCUMENT (
    ID bigint(20) NOT NULL AUTO_INCREMENT,
    CONTENT varchar(255) DEFAULT NULL,
    PRIMARY KEY (`ID`)
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8
  </code></pre>
  
  <p>Database version:</p>
  
  <p><code>MySql 5.5.17 MySQL Community Server (GPL)</code></p>
  
  <p>JPA/Hibernate Entity  (summary) - </p>
  
  <pre><code>@Entity
  @Indexed
  @Table(name="CONTENTDOCUMENT")
  
  public class ContentDocument{
      @Id
      @GeneratedValue(strategy=GenerationType.IDENTITY)
      @Column(name="ID")
      public Long getId() {
          return id;
      }
  
      @Column(name="CONTENT")
      public String getContent() {
          return content;
      }
  }
  </code></pre>
  
  <p>DBunit dataset</p>
  
  <pre><code>&lt;dataset&gt;
      &lt;CONTENTDOCUMENT ID="1" CONTENT="TestContent1"/&gt;
      &lt;CONTENTDOCUMENT ID="2" CONTENT="TestContent2" /&gt;   
  &lt;/dataset&gt;
  </code></pre>
  
  <p>Any clues?</p>