db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matteo Barbieri <m.barbi...@ste-energy.com>
Subject Saving two related objects
Date Fri, 17 Feb 2006 10:05:16 GMT
maybe it's a stupid question, but I got an error that I don't know why
it happens.

I have two tables that are related by foreign key.

I have to create one istance of both objects and to save them.

I do something like this:

FirstClass first = new FirstClass();
SecondClass second = new SecondClass();



the first object is saved correctly, but then I got an SQLException:

java.sql.SQLException: Cannot add or update a child row: a foreign key
constraint fails

I've tried to print both objects before every saving and the second
object has the correct foreign key.

Any idea?


Matteo Barbieri
S.T.E. s.r.l.

To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org

View raw message