One possible solution would be to have a version of the delete method,
which does not wrap the delete in cftransaction, e.g.
deleteNoTransaction(). You could then call this version. I know its not
ideal as it leads to code duplication and I'm not sure if transactions
can even span cfc calls but its just an idea.

Kola

-----Original Message-----
From: Jim Davis [mailto:[EMAIL PROTECTED]
Sent: 03 October 2003 06:14
To: CF-Talk
Subject: Nesting CFTRANSACTION?

I'm in a position where a component can have a parent/child relationship
with other components of the same type.

When I delete a single component, no problem - the method starts a
transaction, deletes the component information from the database, cleans
up references to it in several join tables and updates a couple of
administrative tables.

When a component has Children I would like to delete them as well in the
same transaction.  The best way to do this, of course, is to loop
through the children and call their "delete()" methods.

However when I do this (as I am) from with the parents delete() method
(making the call sorta recursive-like) I get the error we all know and
love: "Cannot nest CFTRANSACTIONS"

In short I don't want to really nest a transaction (that makes no real
sense) I simply want a way to include all the work in a single
transaction.  Some way to determine if I'm in a transaction already and
not try to start a new one.

I'm trying to find some way to do this, perhaps by catching and using
the nesting error itself - but nothing remotely elegant is presenting
itself.

Any solutions, ideas or workarounds?

Jim Davis



  _____  

[Todays
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to