Title: SV: Roll-BACK question.
Referring to the EJB1.1 spec, application exceptions (i.e. any exception that you make, subclassed from Exception) do not roll back transactions.  This is so that EJB can give the application a chance to recover from the exception.  To make the transaction roll back, call setRollbackOnly() on your EJB's context.
 
Mike
----- Original Message -----
From: Eddie Post
Sent: Tuesday, August 07, 2001 10:24 AM
Subject: Re: Roll-BACK question.

Thanks Patrick,
 
Let me check if I understand you correctly:
So what I do is: make my own Exception, that extends Exception, and just before I throw my exception I call setRollbackOnly....
that's it ??
 
Thanks,
Eddie
----- Original Message -----
Sent: Tuesday, August 07, 2001 3:38 PM
Subject: SV: Roll-BACK question.

Accordning to the EJB spec you can NEVER let your exceptions extend RemoteException. They must inherit java.lang.Exception either directly or indirectly (although not java.rmi.RemmoteException or java.lang.RuntimeException). Also, prior to throwing your application exception, call setRollbackOnly() on the ejbcontext. This will mark the current UserTransaction as Rollback only effectively preventing a commit.

regards,
Patrik Andersson

-----Ursprungligt meddelande-----
Från: Eddie Post [mailto:[EMAIL PROTECTED]]
Skickat: den 7 augusti 2001 11:36
Till: Orion-Interest
Ämne: Roll-BACK question.


Hellu,

I want to to force a roll-back in my EJB method (I use CMP), under certain
curcumstances.
I like to do that by trhowing a self-made exception, but this doesn't work,
please some help ?

What I do ?:
I extend an self-made exception on  RemoteException (also extended it on the
EJBException) and throw that in my EJB method. I intercept this in my client
servlet, but no roll-back is forced.
If I throw a RemoteException, which undergoes the same interception in the
client, I do get a roll-back.

How must I do this ? Please some help as I can't find any clear information
on this subject ?

Help :(
Eddie

Reply via email to