Hi Anamitra,

Consider the two types of exceptions relevent in ejbs:  System and application
Exceptions.  System exceptions are those that extend RuntimeException (or EJBException,
which itself is a RTE).  App exceptions are all non RTEs.

A container will only automatically rollback a txn when a system exception is thrown 
out
of the ejb.  If you throw a application exception and wish to rollback, you need to do 
so
manually via setRollbackOnly().  Hope that helps.

Gene
--- Anamitra Bhattacharyya <[EMAIL PROTECTED]> wrote:
> 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".
>


__________________________________________________
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".

Reply via email to