
MTS Transactions Questions
Hi scott,
the approach i usually use is:
on error goto errorhandler
M1 insert
errorhandler: RAISE error
on error goto errorhandler
M2 update
errorhandler: RAISE error
all of these data components are marked 'supports transactions' and have the
standard errorhandler that simply Raises an error
then you have bus1
Bus1
On error goto errorrhandler
M1 execute
M2 execute
Setcomplete
Errorhandler: setabort
This one is indeed marked 'requires transactions'. You don't need to check
after each individual statement, since they're part of the same transaction
and the Raised error from your DB component will 'bubble up' to the BUS
errorhandler, which will call Setabort, thus flagging the tranaction as
aborted.
clean and simple :)
cheers
Sam Goutsmit
Quote:
> Hello,
> Trying to understand tarnsactions Under MTS / Com+
> If I Understand this, one approach to doing transactions is to write a
> bunch of small granular methods and mark them "Uses Transactions". Like
> M1 Insert into database
> M2 Update database
> M3 delete from database
> M4.Insert into database
> Then you write a component that uses these granular methods within the
> MTS Context to do some sort of business stuff and mark it as "requires a
> transaction" Like
> Bus1
> do stuff
> m1.execute
> if ok then setcomplete else setabort
> do stuff
> m2.execute
> if ok then setcomplete else setabort
> Is this close of have I missed the boat.
> Thanks
> Scott