Luiz Fernando Rodrigues wrote:
I have a bidirectional (User-Address) association in my model. When I
run db-unit it fails because it tries to insert user rows with
association to address, but there is no address created, so I receive
a FK violation.
Single bi-directional associations are rarely recorded as columns on
both tables. In that case, you just need to make sure that the tables
are listed in a good order in your sample-data.xml file.
Can I turn off FK constrains before inserting the rows and the turn
then on again? (I'm using postgres, but it should not matter, should
it?)
If you have multiple associations, you may end up with circular
dependencies, and it can get trickier. You may need to drop those
constraints and recreate. I don't have a good solution for this, but I
wrote up what I do a week ago:
http://www.nabble.com/about-circular-dependency-in-models-tf2779209s2369.html#a7775198
If you find a non-manual way to do this, please let me know.
-Dale
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]