Jared Rypka-Hauer on Named Transactions Feature Request

Jared just did a blog post over at Alagad on a feature request for named transactions.  I have to chime in here and say that I really, really, really, want this feature!

The current restriction of having transactions only within a <cftransaction></cftransaction> block is incredibly limiting from a OO perspective.

Something that I had on the radar for Transfer
was to be able to control the Transactions at a database level with
your code, as well as automatically clearing from cache the relevant
objects if something went wrong.

Essentially it would go something like this:

transaction = getTransfer().getTransaction();

    employee = getTransfer().get("employee", 1);

    manager = getTransfer().get("employee", 4);

catch(Any exc)

this code, if we got to the 'transaction.rollback()', not only would it
roll the DB data back, but it would also intelligently discard the
'employee' and the 'manager' objects from cache – thus ensuring that
there was no dirty data.

Currently, with ColdFusion transactions
structured the way they are, it's actually impossible for me to do
this, as there is no <cftransaction> block, and I have no hook to pick up when something goes wrong.

With a named Transaction block, I could internally handle how transactions where managed inside my Transaction.cfc, and and I could pick up the rollback() or commit() call as appropriate.

This would be an incredibly handy thing, so count me on a big +1 for this feature!

Leave a Comment


  • Luis Majano | December 1, 2007

    I totally agree Mark. ColdFusion lacks so much on Transaction Management. Although complex, they would be a great tool when creating software that can handle multiple transactions, even across datasources or even, non-db transaction. A way to programmatically roll back an atomic transaction. So hopefully CF can take what has been available for enterprise java.

  • J. Mihai | December 17, 2007

    Why has my comment been removed ? 🙁 I was trying to contribute to your post, yet my comment is gone…

  • Mark | December 18, 2007

    J – sorry about that, what was your comment?

    I get a bit of comment spam, so I may have deleted yours by mistake! My apologies!

  • J. Mihai | December 18, 2007

    It makes no difference, I will post again with more details now. I have found some interesting articles related to OO perspectives and I wanted to ask something about it. I will post again as soon as I have time to compile the list of questions again.