Title: 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