Transaction demarcation is a business-tier concern, not a
persistence-tier concern.  To put that another way, it's business
logic that determines which persistence ops share a transaction and
which are standalone.  So it belongs in your services.

If you're using ColdSpring, I've written a simple TransactionAdvice
CFC 
(http://www.barneyb.com/barneyblog/2007/06/01/i-wanna-go-wii-part-one-transactionadvice/)
that can be used to declaratively apply transactionality  to your
service objects instead of doing it in code.  It also magically takes
care of nesting of your business methods (so they don't try to create
nested transactions).  You give up some flexibility with this model,
of course, but that flexibility is unneeded in a majority of cases,
and the "one less thing to worry about" factor is high.

ORM tools, since they are in the persistence layer, generally
shouldn't care about transactions.  They might impose a requirement
that a transaction exists for correct behaviour (i.e. because they do
stuff in multiple statements that should be considered a unit), but
they shouldn't control where/how the transactions are applied.

cheers,
barneyb

On 7/27/07, henry ho <[EMAIL PROTECTED]> wrote:
> Dear CFC experts,
>
> In order to save a BO in my app, I need to update several tables in my DB as 
> there are PK/FK dependences.  Transaction is needed, but Where to do it, and 
> How to do it?
>
> I use Illudium Code Generator, so every table has its own DAO/Gateway/Service.
>
> *Where?*
> 1.) at a custom method in the parent table's DAO
> 2.) at a custom method in BO's Service layer
>
> *How?*
> 1.) call a store procedure, and let the DBMS handle the transaction
> 2.) write TSQL (in my case, Ms-sql) inside cfquery
> 2.) use cftransaction, (performance hit is quite large)?
>
>
> And lastly, how would ORM fit into the picture?  How would Transfer, for 
> example, help me at this situation?
>
>
> Thank you,
> Henry
>
>

-- 
Barney Boisvert
[EMAIL PROTECTED]
http://www.barneyb.com/

Got Gmail? I have 100 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Get the answers you are looking for on the ColdFusion Labs
Forum direct from active programmers and developers.
http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284740
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to