innoDB

On Jul 1, 4:49 am, Mark Mandel <[email protected]> wrote:
> You're not using myISAM tables are you?
>
> Mark
>
> On Wed, Jul 1, 2009 at 9:23 PM, whostheJBoss 
> <[email protected]>wrote:
>
>
>
>
>
> > It's on MySQL 5, and no, this is a clean Transfer, not the modified
> > AOP version.
>
> > On Jul 1, 4:00 am, Mark Mandel <[email protected]> wrote:
> > > What DB is this on?
>
> > > Is this your modified code? I believe you made significant changes to the
> > > way transaction AOP worked?
>
> > > Mark
>
> > > On Wed, Jul 1, 2009 at 8:52 PM, whostheJBoss <[email protected]
> > >wrote:
>
> > > > Perhaps I'm doing this totally wrong, but this is what I'm trying...
>
> > > > I have a bean called userService:
>
> > > > <bean id="userService" class="model.users.userService">
> > > >        <constructor-arg name="transfer">
> > > >                <ref bean="Transfer" />
> > > >        </constructor-arg>
> > > >        <constructor-arg name="transaction">
> > > >                <ref bean="TransferTransaction" />
> > > >        </constructor-arg>
> > > >        <constructor-arg name="userGateway">
> > > >                <ref bean="userGateway"/>
> > > >        </constructor-arg>
> > > > </bean>
>
> > > > This is the TransferTransaction that I am passing to the constructor
> > > > on userService:
>
> > > > <bean id="TransferTransaction" factory-bean="ColdboxOCM" factory-
> > > > method="get">
> > > >   <constructor-arg name="objectKey"><value>TransferTransaction</
> > > > value></constructor-arg>
> > > > </bean>
>
> > > > In the init method of userService I do:
>
> > > >        <cffunction name="init" access="public" output="false"
> > > > returntype="userService">
> > > >                <cfargument name="transfer" type="transfer.com.Transfer"
> > > > required="true" />
> > > >                <cfargument name="transaction"
> > > > type="transfer.com.sql.transaction.Transaction" required="true" />
> > > >                <cfargument name="userGateway" type="userGateway"
> > > > required="true" />
>
> > > >                <cfset variables.transfer = arguments.transfer />
> > > >                <cfset variables.userGateway = arguments.userGateway />
>
> > > >                <cfset arguments.transaction.advise(this,"saveuser")>
>
> > > >                <cfreturn this/>
> > > >        </cffunction>
>
> > > > Now, as far as I'm aware, this should now wrap saveuser method on
> > > > userService in a transaction, so that if anything fails inside of a
> > > > call to userService's saveuser method then all database actions that
> > > > happened during the transaction (during the saveuser method) will be
> > > > rolled back.
>
> > > > In my handler I do:
>
> > > >                userService = getPlugin("ioc").getBean("userService");
> > > >                user = instance.Transfer.new("users.user");
> > > >                user.setEmail("[email protected]");
> > > >                user.setPassword("test");
> > > >                user.setAccountType(2);
> > > >                userService.saveuser(user);
>
> > > > So, this works and the database entry is created.
>
> > > > However, if I go into my userService and add some bad code in the
> > > > saveuser method:
>
> > > >        <cffunction name="saveuser" access="public" output="false"
> > > > returntype="void">
> > > >                <cfargument name="user" type="any" required="true" />
>
> > > >                <cfset variables.transfer.save(arguments.user) />
> > > >                <cfset variables.transfer.save(arguments.FAKEOBJECT) />
> > > >        </cffunction>
>
> > > > Since FAKEOBJECT doesn't exist, it throws an error. However, the save
> > > > right before it worked and stays in the database.
>
> > > > I was under the impression that this kind of transaction would roll
> > > > back the first save also when the FAKEOBJECT save failed since they
> > > > are both advised by this:
>
> > > >                <cfset arguments.transaction.advise(this,"saveuser")>
>
> > > > I have also tried do this inside of my handler instead:
>
> > > > transaction = getPlugin("ioc").getBean("TransferTransaction");
>
> > > >                userService = getPlugin("ioc").getBean("userService");
> > > >                user = instance.Transfer.new("users.user");
> > > >                user.setEmail("[email protected]");
> > > >                user.setPassword("test");
> > > >                user.setAccountType(2);
>
> > > >                args = structNew();
> > > >                args.user = user;
> > > >                transaction.execute(userService, "saveuser", args)
>
> > > > But I get the same results. When there is no bad code in the saveuser
> > > > method, it works fine and I see the insert in the database, but when I
> > > > add the FAKEOBJECT to produce an error like so:
>
> > > >                <cfset variables.transfer.save(arguments.user) />
> > > >                <cfset variables.transfer.save(arguments.FAKEOBJECT) />
>
> > > > The first save isn't rolled back, the new object stays in the
> > > > database.
>
> > > > Any ideas why a simple transaction isn't rolling back the database?
>
> > > > Thanks!
>
> > > --
> > > E: [email protected]
> > > T:http://www.twitter.com/neurotic
> > > W:www.compoundtheory.com
>
> --
> E: [email protected]
> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/transfer-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to