Data insertion problem with DBUnit

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Data insertion problem with DBUnit

Surti Pratik
Hi All,

I am trying following approach and getting problem while inserting or updating the data.

I have a table named product_brand and having single column brand_code which is primary key of the table. Now in dataset I have following data:

<?xml version='1.0' encoding='UTF-8'?>
<dataset>
  <product_brad brand_code="b1"/>
  <product_brad brand_code="b2"/>
</dataset>

Now I am adding following row in in dataset file:

<dataset>
  <product_brad brand_code="b1"/>
  <product_brad brand_code="b2"/>
  <product_brad brand_code="b3"/>
</dataset>

According to me, It should update the row in database table but the row is not getting updated. I tried following data set operation one by one but it is not updating a single row in my db.

                DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet);
                DatabaseOperation.UPDATE.execute(connection, dataSet);
                DatabaseOperation.REFRESH.execute(connection, dataSet);
                         DatabaseOperation.INSERT.execute(connection, dataSet);

If there are more than one table which may have dependeny on each other then the columns and row are getting updated.

Is there any thing that I should add which might be missing as I am simply appending a row only?