Jorge Roberto
Jorge Roberto

Reputation: 157

error NoSuchColumnException DbUnit

I have a table with a JSON column and when I run my tests with the dataset.

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

my dataset:

 <?xml version="1.0" encoding="UTF-8"?>
 <dataset>

   <hero id='000580548' json='{"id" : 1,"name" : "mySuperHero"}'/>
   <hero_profile id='000580548-mySuperHero' json='{"habilities": [], "stars" : 7}'/>
</dataset>

Obs: my tables already exists in the database.

Upvotes: 3

Views: 1777

Answers (2)

Optio
Optio

Reputation: 7652

You can do it with trick:

<hero 
id="000580548" 
json="{&quot;id&quot; : 1,&quot;name&quot; : &quot;mySuperHero&quot;}"
/>

It's work for us.

Upvotes: 0

Anton G
Anton G

Reputation: 71

By default DbUnit does not understand json field setup. Either you omit it in tests or write custom extension for DbUnit

Upvotes: 2

Related Questions