Artur Z wrote:
Company company = new Company(); Address address = new Address(); company.setAddress(address); company.save(conn); // I'd like that this saves also address but it does not //but the most important thing is that when I call: address.save(conn); //an exception will be thrown - before the above line I shoul do: company.setAddress(address); or address.setCompany(company);
The address needs to exist in the DB before the company record can be saved with a reference to this address.
The generated Torque code only saves the object, not its depencies.
You need to
address.save(conn);
make sure its PK is now in the address object (I think Torque fills this automatically). Then
company.setAddress(address);
company.save(conn);
Of course you could generate code that saves all new dependent object first and then the object itself. You can generate anything. ;-)
--
Regards/Gru�,
Tarlika Elisabeth Schmitz
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
