Two Laptop Bag*
The moose likes Testing and the fly likes Foreign-key Problems in DBUnit Test Data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Testing
Bookmark "Foreign-key Problems in DBUnit Test Data" Watch "Foreign-key Problems in DBUnit Test Data" New topic
Author

Foreign-key Problems in DBUnit Test Data

Vineela Jyothi
Greenhorn

Joined: Jun 02, 2008
Posts: 3
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>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Foreign-key Problems in DBUnit Test Data