Hi Anamitra,

In case of an application exception, the container re-throw the application
exception to the caller. Clients, on receiving the application exception may
or may not continue the transaction. The container will attempt to commit
the transaction if setRollbackOnly is not called. The transaction will be
rolled back if setRollbackOnly is called. Please refer Table15 and other
tables in EJB2.0 final specification for exact behaviour in different cases.

In instances of application exception, the client may recover from the
exception and may wish to continue and commit the current transaction.

Regards,
Hemant
www.pramati.com

----- Original Message -----
From: "Anamitra Bhattacharyya" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, May 06, 2002 5:10 AM
Subject: exception and rollback in CMT


Hi
This is again a bit basic question - I am confused as
to what the container does to its TX when an
application exception is thrown. After reading specs
it seems that on throwing application exception from
an EJB (having CMT) - the container tries to commit
the TX if the container started the TX - but will not
do anything if the TX was started by say a servlet (by
explicitly calling usertx)
so in case of flow
servlet(starts TX) -> call ejb-> app exception -> no
rollback

servlet -> ejb (container starts TX as "Required") -
app exc-> container tries to commit and sends the app
exc to the caller.
Am I right??
If I am right dosent anyone think the logical
behaviour in the 2nd case should have been for the
container to try to rollback the TX instead of
commiting it?
Anyways I think the best practice is to call
ctx.setRollbackOnly() in the both cases - right?
TIA
Anamitra

__________________________________________________
Do You Yahoo!?
Yahoo! Health - your guide to health and wellness
http://health.yahoo.com

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to