i think you need transaction attribute 'RequiresNew' in B, and 'Requires' on
A.
then A has to catch B's remote exception.

ejb-jar.xml like:

       <container-transaction>
         <method>
          <description>Transaction-handling for the SmsManager</description>
          <ejb-name>nl.unwired.sgs.sms.SmsManager</ejb-name>
          <method-intf>Remote</method-intf>
          <method-name>A</method-name>
         </method>
         <trans-attribute>Required</trans-attribute>
       </container-transaction>
       <container-transaction>
         <method>
          <description>Transaction-handling for the SmsManager</description>
          <ejb-name>nl.unwired.sgs.sms.SmsManager</ejb-name>
          <method-intf>Remote</method-intf>
          <method-name>B</method-name>
         </method>
         <trans-attribute>RequiresNew</trans-attribute>
       </container-transaction>

code like:

A(){
        try{
                b();
        } catch(Exception ex){}
}

so B will execute in a new transaction and rollback when an exception is
thrown. A will finish wihtout throwing an exception and commit its own
transaction.




-----Original Message-----
From: Eddie [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 26, 2001 8:08 AM
To: Orion-Interest
Subject: Re: Transaction question


Hellu hellu,

Please some advise on the question I posted some days ago  (see below)?

Eddie

----- Original Message -----
From: "Eddie" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Tuesday, July 24, 2001 10:47 AM
Subject: Transaction question


> Hellu,
>
> I don't know how to configure the following transaction scenario with CMP.
> Please some help or maybe a little example:
> I have two bean methods: A and B.
> A calls B and I want that when B throws a RemoteException that A
intercepts,
> that B performs a rollback and A not !
> I know how to do that in the code (I think): A just catches the
> remoteException of B and doesn't throw it outside his method.
>
> However how do I configure this in the xml file ??
> I now have the following in my ejb-jar.xml, which mean that all the
methods
> execute in the same transaction:
> ----
>       <container-transaction>
>         <method>
>          <description>Transaction-handling for the
SmsManager</description>
>          <ejb-name>nl.unwired.sgs.sms.SmsManager</ejb-name>
>          <method-intf>Remote</method-intf>
>          <method-name>*</method-name>
>         </method>
>         <trans-attribute>Required</trans-attribute>
>       </container-transaction>
> ----
>
> As far as I understand it, I have to configure that method B has
> "RequiresNew set, but how do I configure this in the xml file, such that
the
> rest still use "Required" ??
> And is this the correct way to do it ??
>
> Please some help as I can't find anything on the Internet (mail-archive
> etc..),
> Eddie
>
>
>

Reply via email to