[Catalyst] how to implement Transactions (over different db tables) in a Catalyst project

kakimoto at tpg.com.au kakimoto at tpg.com.au
Mon Jul 6 05:30:23 GMT 2009

hi , everyone,

 i m trying to put transactions in place for my catalyst project.

 For example, I would like to create a new user subscription.
 What this does is,
 - create two new Address objects (Address db table) where one's for
billing address and another for main contact.
 - create a new User Subscriptions object (and link the two new Address
objects by IDs into attributes, billing_address_id and

 What I have refered to:



In the past, when I had to work with just DBI, I would manually start a
transaction and commit it at the end if no exceptions occur. In
 the case of the latter, I will call a rollback.

 How do I do it here in Catalyst/DbiX::Class land?
I tried to read up the
doc but I can't see how the example can apply to Catalyst.

It says, "$schema->txn_do($coderef)" to get the schema but in catalyst,
we access the
database tables directly. For example,

my $rs = $c->model('myAppDB::UserSusbcriptions')->search( .. );

I'm a bit confused and have looked in a few places. Can anyone please
educate me?

thank you:)


More information about the Catalyst mailing list