db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdietr...@sega.com
Subject insert dependencies during transactions
Date Thu, 17 Jul 2003 15:51:16 GMT
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...
UserInfo userInfo = new UserInfo();
// set user info attributes

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?



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

View raw message