To answer my own question: the problem wasn't torque at all. We had failed to set idMethod="none" for tables with 1:1 relationships with the user table, so that torque was generating its own primary key values and then the DB was complaining about unique constraint violations.

[EMAIL PROTECTED] wrote:
I'm trying to use transactions to manage a sequence of
insert/update statements, and I'm getting foreign key
constraint violations on the later insert statements.  The
sequence is something like this (excuse any syntactical
errors, as I'm not copying and pasting):

Transaction trans = new Transaction();
Connection conn = trans.begin(dbName);
User = new User();
// set user attributes...
user.save(conn);
UserInfo userInfo = new UserInfo();
// set user info attributes
user.addUserInfo(userInfo);
user.save(conn);


There is a foreign key constraint which links user_info.user_id to user.user_id. I was under the impression that as long as I used the same connection for these sequential update statements, I could get away with the code above. Clearly this is not the case, however, as I'm getting a TorqueException (unique constraint violation at the second user.save() call). Is there a workaround for this?

Thanks.

-rob

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to