If you ask me, this is one of the larger problems with architecting applications in CFML. I've employed two solutions:
1) If you're using CFMX only (not BD), you create a TransactionManager component that deals with your transactional processing, and never use CFTRANSACTION at all. Since you're writing it yourself, you can handle nested calls to mean "start a transaction if no transaction is active, otherwise just continue the current transaction." Of course, you lose some of the benefits of the tags, like the compiler ensuring you always have matching tags, and the runtime taking care of rolling stuff back if an exception is raised. It sounds good on paper, but in reality is rather clunky. 2) Split your business operations into two tightly coupled layers. The top layer is public, the bottom layer is protected. The top layer starts a transaction, delegates to the bottom layer, and ends the transaction. All calls between services should be to the bottom layer. This works well, except that it doubles the number of methods and there's not a good way to ensure that clients (your UI) can only call the top layer unless all your services are in a single package with no other CFCs. A third option that I haven't tried would be to use a service method dispatcher that all method calls run through. So you call dispatcher.runMethod(obj, methodName, args), and then the dispatcher can do "stuff", including apply a transaction to the entire method call. This is kind of like how EJBs work, but EJB has a whole server that writes a HUGE amount of code ot make this a lot less painful for you the developer. You could do that with CFCs, but the platform would be more complex then your app, unless your app is quite significant. Overall, though, I'd prefer CFTRANSACTION to just grow a "join existing" boolean option, that, if true, would let nested instances just combine into one big transaction. cheers, barneyb On 1/19/06, Stan Winchester <[EMAIL PROTECTED]> wrote: > Where should cftransaction tags go when using cfc's? For example: If the > cftransaction tags should be in the cfc, what if the cfc method calls > another method that also has cftransaction tags that should cause an error > to be thrown. Since cftransaction tags cannot be nested, should they go in > the action page as a wrapper around all methods using cftransaction tags? > > > > Thank you, > > Aftershock Web Design, Inc. > > by: Stan Winchester -- Barney Boisvert [EMAIL PROTECTED] 360.319.6145 http://www.barneyb.com/ Got Gmail? I have 100 invites. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:230059 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

