On Fri, 17 Dec 2004 16:44:57 +0100, Lamotte Denis <[EMAIL PROTECTED]> wrote:
>  If there is an expression error or any other type of error,
>   when reaching <cftransaction action="rollback"/>  you 'll have an error
>  Java.langException.nullvalue (or something like that) and nothing in the
> transaction is rolling back

I've never seen that happen.

>  If you look at the code below (used in a mach-ii app) 

That code seems very suspicious to me. It's unnecessarily complex - if
the contents of the <cftry> above <cfcatch> were simply wrapped in
<cftransaction> .. </cftransaction> then you wouldn't need any of the
other commit / rollback stuff. And I think Stacy might be right about
the begin transaction needing to be outside the try block if you still
want to use commit / rollback.

Reworked example code:

>   <cftry>
>      <cftransaction> <!--- changed --->
>  
>      <cfset defaultDataUserObj=createDefaultUser() />
>      <cfset userDao.create(defaultDataUserObj) />
>      <cfset
> DataBean.setProperty("DataUserID",defaultDataUserObj.getproperty("UserID"))
> />
>      <cfset
> application.ApplicationBean.getProperty("datadao").create(dataBean)/>
>  
        </cftransaction> <!--- added --->
>   <cfcatch type="DATADAO.create.NONUNIQUE.title">
>      <cfset DATAbean.setInvalidFields("title") />
>      <cfset DATAbean.setInvalidFieldsMessage("title","title already Taken")
> />
>      <cfset EventArgs["DATAbean"] = DATAbean />
>      <cfset Continue= false />
>   </cfcatch>
>   <cfcatch type="DATADAO.create.NONUNIQUE.path">
>      <cfset DATAbean.setInvalidFields("path") />
>      <cfset DATAbean.setInvalidFieldsMessage("path","path already Taken") />
>      <cfset EventArgs["DATAbean"] = DATAbean />
>      <cfset Continue= false />
>   </cfcatch>
>   <cfcatch type="any">
>   <!--- some other DAO-generated exception --->
<!--- removed rollback --->
>      <cfrethrow />
>   </cfcatch>
>  
>   </cftry>
>  
>   <cfif Continue >
<!--- removed commit --->
>      <cfset announceEvent("createDATASuccessEvent", EventArgs) />
>   <cfelse>
<!--- remove rollback --->
>      <cfset announceEvent("createDATAFailureEvent", EventArgs) />
>   </cfif>
-- 
Sean A Corfield -- http://www.corfield.org/
Team Fusebox -- http://www.fusebox.org/
Breeze Me! -- http://www.corfield.org/breezeme

"If you're not annoying somebody, you're not really alive."
-- Margaret Atwood
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at 
[EMAIL PROTECTED]

Reply via email to