I have two tables, one of table A's fields references table B's field, I use annotation @DatabaseSetup to do the importing of xml file, and I wrote both table A and table B's data in the dataset in the xml file. when I run the unit test, it says INSERT on table A caused a violation of foreign key constraint for key(0).
how to express the reference relationship between the two tables?
I presume your dataset XML file looks something along the lines of:
<TABLE_A ID="1"/>
<TABLE_B ID="1" TABLE_A_ID="1"/>
This violation could occur if:
<TABLE_A ID="1"/>
<TABLE_B ID="1" TABLE_A_ID="2"/>
<TABLE_B ID="1" TABLE_A_ID="1"/>
<TABLE_A ID="1"/>
If you provide your dataset file and Db Unit Test I can be more specific