This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Foreign-key Problems in DBUnit Test Data

 
Vineela Jyothi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a dataset xml (input.xml) file for a table "Trade".
Trade table has a column "desc_id" which is foreign key for table "Desciption" column "id".
In both the tables, the id is auto-increment by the Database.


If i dont specify any value for "desc_id" in the below input.xml, i get an error "desc_id could not be null..."
If i specify any random value, i get the error "com.sybase.jdbc3.jdbc.SybSQLException: Foreign key constraint violation occurred..."


Please suggest me how to deal with this.


Here is my input.xml:
<?xml version='1.0' encoding='UTF-8'?>
<dataset>
<trade version="1" is_latest="true" status="DONE"
user_information="XXXXXX500005" upstream="ABC"
format="REAL" create_datetime="2012-06-20 00:00:25" />
<trade version="1" is_latest="true" status="DONE"
user_information="YYYYY500005" upstream="HKK"
format="FPB" create_datetime="2012-06-20 00:00:25" />
<trade version="1" is_latest="true" status="SENT"
user_information="ZZZZ500005" upstream="SCC"
format="REAL" create_datetime="2012-06-20 00:00:25" />
</dataset>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic