[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 11:32:17 GMT 2009

hi Tomas and everyone:)

 I still have some questions as per my prev post. Can you please help me
out? :)

I have the following questions:
1) I looked at the terminal with all the debug messages. I noticed that
the exception was caught and eventhough the roll back was done, I do not
see the print outs from the liens within the "if ($@)" (exception
handling) section above. Why is that?

2) I noticed that whilst the rollback was successful. the sequence do
not get rolled back.
IS this desired behaviour of DBIx::Class?

 To illustrate,  before the exception was caught, an entry was made in
my User_Subscriptions database table. The ID was printed out and I took
note of it.
When the operation was complete, I queried my User_Subscriptions
database table (using psql for postgresql for an entry of the noted ID).
No entry of the noted ID was returned.
I went back to the webpage and entered the form with valid attributes
and yes, all
necessary objects were created in the database backend and the sequence
in the User_Subscriptions database table had increased by 1.


> And I'm crap.
> You need $c->model('myAppDB')->schema->txn_do( sub {
> Cheers

More information about the Catalyst mailing list