You absolutely can do this. There was a whole discussion on this issue and 
CFTRANSACTION tags on the Reactor mailing lists this week. By doing:

<cftransaction>
    <cfset mainObjDAO.create()/>
    <cfset relatedObj_1DAO.create()/>
    ....
    <cfset relatedObj_nDAO.create()/>

</cftransaction>

you will encapsulate all your INSERT SQL statements within the single 
transaction statement. I would suggest using CFTRY/CFCATCH around this as well 
to do any other processing needed to recognize that information hasn't been 
persisted or if/else since you are returning a Boolean from these methods. I do 
not recall if it was supported in all MX versions or not, though. The result 
was that Reactor will now allow for internal DAO transactions or allow a set of 
calls to various DAOs to be wrapped in a CFTRANSACTION tag based on a parameter 
similar to what you want to do in this case. HTH,

Phil

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Salvatore Fusto
Sent: Wednesday, April 26, 2006 12:00 PM
To: [email protected]
Subject: Re: [CFCDev] <cftransaction>

Hi Duba,
the "atomic" DAO's for tables do not contain any cftransaction tag, as they 
only manipulate a single table insert operation; they only returns true or 
false if the insert query has been successfully comleted or not: my doubt is 
if i can encapsulate all these DAO's create() methods in a cftransaction 
tag, instead of sql statements.
regards
salvatore


----- Original Message ----- 
From: "Duba, Phillip" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, April 26, 2006 4:10 PM
Subject: RE: [CFCDev] <cftransaction>


Salvatore,

You can absolutely do this assuming those create functions do not
contain cftransaction tags themselves and also assuming that the create
functions contain database manipulation functions as well. HTH,

Phil

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Salvatore Fusto
Sent: Wednesday, April 26, 2006 6:23 AM
To: [email protected]
Subject: [CFCDev] <cftransaction>

Hi all,
suppose i've a complex object, composed of other objects. after having
populated my complex obj in the model layer, i' ve to persist it: in my
database i have a main object table and other related table, 1 to1,1 to
many,many to many.
I have a dao and a gateway for every object, so in witten a facade layer
to
persist my compmex object, having:

<cfset objfacade.write(mycomplexObj)/>

in the facade i have

<cfset mainObjDAO.create()/>
<cfset relatedObj_1DAO.create()/>
....
<cfset relatedObj_nDAO.create()/>

can i encapsulate all the last invocattion in a transaction

<cftransaction>
    <cfset mainObjDAO.create()/>
    <cfset relatedObj_1DAO.create()/>
    ....
    <cfset relatedObj_nDAO.create()/>

</transaction>
regards
salvatore



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to
[email protected] with the words 'unsubscribe cfcdev' as the subject of
the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
(www.cfxhosting.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]




----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]



__________ Informazione NOD32 1.1508 (20060426) __________

Questo messaggio  รจ stato controllato dal Sistema Antivirus NOD32
http://www.nod32.it




----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]




----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at 
www.mail-archive.com/[email protected]


Reply via email to