51578

DBunit and dataset column

Question:

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.

Answer1:

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.

Answer2:

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.

Recommend

  • Handling Multiple pages in spring MVC
  • JPA: How to improve performance in persistance of OneToMany relationships
  • Hibernate mappedby composite key
  • Problem removing entity with JPA
  • MySQL performance using AUTO_INCREMENT on a PRIMARY KEY
  • Mapping ManyToMany with composite Primary key and Annotation:
  • Why not Factory pattern for sorting? [closed]
  • jinja2 template not found and internal server error
  • How to extract text from a PDF and decode characters?
  • Find JSON nested nodes using multiple string values
  • User messaging system
  • Hibernate to update table schema
  • Do query loads all the data in memory
  • Z3: Convert between FP and BitVector?
  • JBoss External Properties Files in Classpath
  • Date Conversion from yyyy-mm-dd to dd-mm-yyyy
  • Groovy: Unexpected token “:”
  • Android - Material Design - NavigationView - How to put vertical scroll?
  • Why Encoding.ASCII != ASCIIEncoding.Default in C#?
  • Jackson Parser: ignore deserializing for type mismatch
  • Replace value with Factor in r data.table
  • Jquery UI tool tip close icon
  • Change multiple background-images with jQuery
  • How to access EntityManager inside Entity class in EJB3
  • Repeat a vertical line on every page in Report Builder / SSRS
  • Encrypt data by using a public key in c# and decrypt data by using a private key in php
  • Counter field in MS Access, how to generate?
  • SSO with signing and signature validation doesn't work
  • Deserializing XML into class C#
  • Trying to switch camera back to front but getting exception
  • Javascript + PHP Encryption with pidCrypt
  • Convert array of 8 bytes to signed long in C++
  • AT Commands to Send SMS not working in Windows 8.1
  • Windows forms listbox.selecteditem displaying “System.Data.DataRowView” instead of actual value
  • Getting Messege Twice Using IMvxMessenger
  • apache spark aggregate function using min value
  • Sorting a 2D array using the second column C++
  • costura.fody for a dll that references another dll
  • How can i traverse a binary tree from right to left in java?
  • How can I use threading to 'tick' a timer to be accessed by other threads?