I'm looking through the code, and I'm seeing that you have a try/catch inside the Transaction itself.
For a transaction to be rolled back, the exception needs to bubble out to the Transaction code. It's exactly the same as if I did: <cftransaction> <cftry> //do stuff <cfthrow message="something went wrong"> <cfcatch></cfcatch> </cftry> </cftransaction> In which case the transaction wouldn't roll back, as you are swallowing the error. I had thought this would have been self evident, but I guess I should have been clearer that Transactions only get rolled back when the exception is thrown. Mark On Thu, Jul 9, 2009 at 1:04 PM, whostheJBoss <dotfus...@changethings.org>wrote: > > I have uploaded the file to the Google Group. > > On Jul 8, 4:21 pm, Mark Mandel <mark.man...@gmail.com> wrote: > > You can just send me a .zip file with a controller and AOP applied etc, > you > > know ;o) Should be much easier. > > > > Mark > > > > On Thu, Jul 9, 2009 at 8:41 AM, whostheJBoss <dotfus...@changethings.org > >wrote: > > > > > > > > > I'll set you up an account on my server for the foo site, I'll just > > > have you change your host file to have foo.com point to my box. I'll > > > put up two handlers, one that uses a service with AOP / execute and > > > one that uses a handler method. > > > > > I'll do this later tonight and hit you up off list. > > > > > On Jul 8, 2:49 pm, Mark Mandel <mark.man...@gmail.com> wrote: > > > > Well, it seems to be running through a Transaction.... so that is > totally > > > > bizarre. > > > > > > I think you will have to send me a test bed. > > > > > > Mark > > > > > > On Thu, Jul 9, 2009 at 4:37 AM, whostheJBoss < > dotfus...@changethings.org > > > >wrote: > > > > > > > Hey Mark, so I've clarified the problem a bit and posted it here to > > > > > preserve formatting again: > > > > > > >http://www.oneclickpost.com/post/5kN09YAYEN/ > > > > > > > Also, here is the tax context you requested. > > > > > > > What you are seeing here is the tag context when I call the > > > > > userService from within my handler method to do the inserts. In > this > > > > > case, the userService itself has no advice applied to it and was > not > > > > > executed within execute(). It is simply being called from within > the > > > > > handler method that is being executed through execute() by another > > > > > method within the handler. So in my handler, I am calling > createUsers > > > > > () which calls transaction.execute(this, _createUsers, arguments) > > > > > > > _createusers() is where the userService call is made. > > > > > > > So, anything that happens within _createUsers() should be rolled > back. > > > > > I have also tried directly calling Transfer within the > _createUsers() > > > > > method: > > > > > > > instance.Transfer.save(1user); > > > > > instance.Transfer.save(user2); > > > > > > > But the result is exactly the same. So whether or not I call the > bean > > > > > (which is not advised or using execute()) it doesn't matter, > handler > > > > > methods when advised or using execute() on another handler method > do > > > > > not roll the transaction back when part of it fails and Transfer > > > > > transaction elements do appear in the tag context. > > > > > > > I typically have been hiding the error with a try/catch, but I > turned > > > > > that off to show you the tag context. Either way, it still works > > > > > improperly and user1 is inserted even when user2 fails. If I have > the > > > > > try/catch around either the call to the service or the direct > > > > > Transfer.save() then the transaction is not rolled back, but if I > > > > > remove this (to display the error in the browser) then user1 is > rolled > > > > > back when user2 fails. Of course, this is not acceptable, I don't > want > > > > > errors on the page. So, the fact that turning off try/catch causes > the > > > > > rollback to happen doesn't say much. It just means that the server > is > > > > > failing everything when the page throws an exception to the > browser. > > > > > This happens in both CF8 and Railo. > > > > > > > Application Execution Exception > > > > > Error Type: database : 0 > > > > > Error Messages: Data truncation: Data too long for column > 'password' > > > > > at row 1 > > > > > > > Tag Context: > > > > > ID: ?? > > > > > LINE: 115 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\sql\QueryExecution.cfc > > > > > ID: ?? > > > > > LINE: 376 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\sql\TransferInserter.cfc > > > > > ID: ?? > > > > > LINE: 137 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\sql\TransferInserter.cfc > > > > > ID: ?? > > > > > LINE: 66 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\sql\TransferInserter.cfc > > > > > ID: ?? > > > > > LINE: 210 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\sql\transaction\Transaction.cfc > > > > > ID: ?? > > > > > LINE: 81 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\sql\transaction\Transaction.cfc > > > > > ID: ?? > > > > > LINE: 50 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\sql\TransferInserter.cfc > > > > > ID: ?? > > > > > LINE: 62 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\sql\SQLManager.cfc > > > > > ID: ?? > > > > > LINE: 199 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\Transfer.cfc > > > > > ID: ?? > > > > > LINE: 182 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\Transfer.cfc > > > > > ID: ?? > > > > > LINE: 105 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\model\users\userService.cfc > > > > > ID: ?? > > > > > LINE: 210 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\sql\transaction\Transaction.cfc > > > > > ID: ?? > > > > > LINE: 81 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\sql\transaction\Transaction.cfc > > > > > ID: ?? > > > > > LINE: 9 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\config\definitions > > > > > \model.users.userservice.usersave.aop.transfer > > > > > ID: ?? > > > > > LINE: 290 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\handlers\test.cfc > > > > > ID: ?? > > > > > LINE: 210 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\sql\transaction\Transaction.cfc > > > > > ID: ?? > > > > > LINE: 89 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\transfer\com\sql\transaction\Transaction.cfc > > > > > ID: ?? > > > > > LINE: 420 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\handlers\test.cfc > > > > > ID: ?? > > > > > LINE: 445 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\coldbox\system\controller.cfc > > > > > ID: ?? > > > > > LINE: 163 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\coldbox\system\coldbox.cfc > > > > > ID: ?? > > > > > LINE: 58 > > > > > Template: C:\Program Files (x86)\Apache Software > > > Foundation\Tomcat > > > > > 6.0\sites\foo\Application.cfc > > > > > > > On Jul 7, 8:45 pm, Mark Mandel <mark.man...@gmail.com> wrote: > > > > > > Actually, thanks for chasing this up. > > > > > > > > Fun question for you then - > > > > > > > > When you are using transaction.execute() (or even the AOP) within > the > > > > > > handler, and you intentionally throw an error to try and rollback > the > > > > > > Transaction, do you see any of the Transfer Transaction elements > in > > > the > > > > > tag > > > > > > context? > > > > > > > > I'm wondering of Luis is doing some method trickery in CB with > his > > > > > handlers. > > > > > > > > Mark > > > > > > > > On Wed, Jul 8, 2009 at 1:36 PM, whostheJBoss < > > > dotfus...@changethings.org > > > > > >wrote: > > > > > > > > > Any thoughts on this? I can repeat this behavior under multiple > > > > > > > configurations. > > > > > > > > > On Jul 3, 8:09 pm, whostheJBoss <dotfus...@changethings.org> > > > wrote: > > > > > > > > Sorry, here: > > > > > > > > > >http://www.pastey.net/117046 > > > > > > > > > > On Jul 3, 6:21 pm, Mark Mandel <mark.man...@gmail.com> > wrote: > > > > > > > > > > > I tried accessing the link.. it's timing out. > > > > > > > > > > > I will try it again later. > > > > > > > > > > > Mark > > > > > > > > > > > On Fri, Jul 3, 2009 at 7:59 PM, whostheJBoss < > > > > > > > dotfus...@changethings.org>wrote: > > > > > > > > > > > > Ok Mark, I've made a detailed, clear and rich example for > > > you. I > > > > > > > > > > didn't want to lose formatting, so I posted it here: > > > > > > > > > > > >http://www.oneclickpost.com/post/2OJ7dD0xtN/ > > > > > > > > > > > > This explains the exact behavior I am seeing and my > > > configuration > > > > > > > > > > attempts that are producing it. > > > > > > > > > > > > If I made any typos, I apologize, you should be able to > get > > > the > > > > > gist > > > > > > > > > > of what I'm doing though. > > > > > > > > > > > > I had gone to the trouble of writing a separate > interceptor > > > that > > > > > > > would > > > > > > > > > > use execute() from Transfer's transaction to execute the > > > handler > > > > > > > > > > method, but I saw the same results as I saw in the post > I've > > > just > > > > > > > > > > linked to. I also used this interceptor to apply AOP > advice, > > > but > > > > > > > > > > again, saw the same behavior that the post describes. > > > Something > > > > > about > > > > > > > > > > advising handler methods or executing them within a > > > transaction > > > > > with > > > > > > > > > > execute() is funky. > > > > > > > > > > > > On Jul 2, 2:30 pm, Mark Mandel <mark.man...@gmail.com> > > > wrote: > > > > > > > > > > > The code for AOP transactions would be exactly the same > for > > > a > > > > > > > ColdBox > > > > > > > > > > > handler as it would be for any other CFC, it's just a > CFC. > > > > > > > > > > > > > Can you send me a reproducible test case, with the DB > you > > > are > > > > > > > using? > > > > > > > > > > > > > Mark > > > > > > > > > > > > > On Fri, Jul 3, 2009 at 3:36 AM, whostheJBoss < > > > > > > > dotfus...@changethings.org > > > > > > > > > > >wrote: > > > > > > > > > > > > > > Oh, and this behavior is on both CF8 and Railo. I > have > > > tested > > > > > for > > > > > > > 10 > > > > ... > > > > read more ยป > > > -- E: mark.man...@gmail.com T: http://www.twitter.com/neurotic W: www.compoundtheory.com --~--~---------~--~----~------------~-------~--~----~ Before posting questions to the group please read: http://groups.google.com/group/transfer-dev/web/how-to-ask-support-questions-on-transfer You received this message because you are subscribed to the Google Groups "transfer-dev" group. To post to this group, send email to transfer-dev@googlegroups.com To unsubscribe from this group, send email to transfer-dev-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/transfer-dev?hl=en -~----------~----~----~----~------~----~------~--~---