think you need to get a DB connection to do the saving with... conn = Transaction.beginOptional("yourb DB name", true);
// then save with the conn object contact.save(conn ); company.setContact(contact); company.save(conn ); Transaction.commit(conn); -----Original Message----- From: Graham Leggett [mailto:[EMAIL PROTECTED] Sent: 18 September 2003 16:46 To: Turbine Torque Users List Subject: Transactions and saving - problems with commit Hi all, I have two Torque generated objects, the first is linked to the second via a foreign key. When I save the objects, I do this: contact.save(); company.setContact(contact); company.save(); And this works fine - both objects are saved correctly, and as they are new objects, Torque handles their primary keys. The trouble starts when the above three statements are saved in a transaction. On the "company.save()" an exception is thrown because the primary key for contact cannot be found in the database, and the transaction support kicks in, rolling everything back. How do I get around this? It seems that supporting both primary keys and rollback at the same time is a catch-22 situation - any ideas what I am doing wrong? Regards, Graham -- ----------------------------------------- [EMAIL PROTECTED] "There's a moon over Bourbon Street tonight..." --------------------------------------------------------------------- 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]