That is rediculous. What's the point of even having nested transactions
then!?
Regards,
Matt Benic
Axapta Developer
UTi Sun Couriers Division
"The universal aptitude for ineptitude
makes any human accomplishment an incredible miracle."
- Col. John P. Stapp
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: 07 December 2004 04:05 PM
To: [EMAIL PROTECTED]
Subject: Re: [development-axapta] Nested transactions and exceptions
Hi Matt,
I've already the same problem as you.
For your second sample(job), you must add a second try .. catch to be able
catching exception
int i;
;
for(i = 0; i < 5; i++)
{
try
{
ttsbegin;
try
{
ttsbegin;
throw exception::Error;
ttscommit;
}
catch(exception::Error)
{
print "Error caught";
pause;
}
ttscommit;
}
catch(Exception::Error)
{
print "Error caught 2";
}
}
print "Finishing application";
pause;
I think that when you throw error and Axapta make a "Rollback", ALL the
transaction is rollbacked and not only the current transaction as write in
the help !
Best Regards,
Olivier Parent ,
Competence Center Axapta
SYLIS Belgium S.A./N.V.
http://www.sylis.be
______________________
Tel 00 32 4 264.00.00
Fax 00 32 4 248.05.38
______________________
"Matt Benic" <[EMAIL PROTECTED]>
07/12/2004 14:15
Please respond to development-axapta
To: "Axapta Dev" <[EMAIL PROTECTED]>
cc: "Hennie Potgieter" <[EMAIL PROTECTED]>, "Edine le Roux"
<[EMAIL PROTECTED]>, "Daniel Redelinghuis" <[EMAIL PROTECTED]>
Subject: [development-axapta] Nested transactions and
exceptions
Hi all,
I'm at a bit of a loss with the transactions and exceptions in Axapta. I
have a nested transaction and I would like to be able to roll back the
inner
transaction, but not the outer one. I initially tried using ttsabort, but
it
seems that ttsabort rolls back the outer transaction as well (ie instead
of
dropping from tts level 2 to 1, it drops to 0). The developer guide
mentions
that exceptions may be used to abort transactions, so I thought I would do
this. Unfortunately the exceptions exhibit very wierd bahavior.
In my origonal case I have an outer transaction around a while look, and
within that while loop, I am trying to set up an inner transaction. Within
the loop I have a ttsbegin, followed by a try-catch that contains a number
of method calls and a ttscommit. Any of the methods may throw an
error::Exception. The try-catch lists only exception::Error. When I run
the
app, the debugger hits the breakpoint on my throw statement, but skips the
catch and it seems that the entire application quits!
I tried testing this in a job, and got similar behavior. The following job
behaves as expected ('error caught' is printed five times and 'finishing
application' is printed once):
int i;
;
for(i = 0; i < 5; i++)
{
//ttsbegin;
try
{
ttsbegin;
throw exception::Error;
ttscommit;
}
catch(exception::Error)
{
print "Error caught";
pause;
}
//ttscommit;
}
print "Finishing application";
pause;
However the following job does not provide any output at all, if a
breakpoint is placed on the throw, it is hit, but stepping over that
causes
the job to terminate:
int i;
;
for(i = 0; i < 5; i++)
{
ttsbegin;
try
{
ttsbegin;
throw exception::Error;
ttscommit;
}
catch(exception::Error)
{
print "Error caught";
pause;
}
ttscommit;
}
print "Finishing application";
pause;
What the heck is going on here? What is the correct way to duck out of a
nested transaction?
Regards,
Matt Benic
Axapta Developer
UTi Sun Couriers Division
"The universal aptitude for ineptitude
makes any human accomplishment an incredible miracle."
- Col. John P. Stapp
Yahoo! Groups Links
[Non-text portions of this message have been removed]
Yahoo! Groups Links
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/development-axapta/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

