Transactions (commit and rollback)

Hi there

I’m coding an action where I have to create two related objects
(models). The thing is that the second one uses the first one’s id
value as its id (the first tables’s id is autoincrement and the second
table’s id is not and get the value from the first table’s id.

How can I do to open a transaction in order to either create both
objects if everything is ok or create no object is something is wrong
(commit or rollback).

Thanks in advance

Regards

Miquel (a.k.a. Ktalà a.k.a. Ton)
Linux User #286784
GPG Key : 4D91EF7F
Debian GNU/Linux (Linux wolverine 2.6.23.1)

Welcome to the jungle, we got fun and games
Guns n’ Roses