from the ejb-2.0 spec, it is a little unclear, but it says that putting a
deafault transaction attribute is ok, and the default will be used for all
methods that are not explicitly defined to have a different transaction
attribute.

so this should work, but if it does not, maybe orion interpreted the spec
differently or has not implemented it correctly....
        <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>
        <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>




-----Original Message-----
From: Eddie Post [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 06, 2001 1:48 AM
To: Orion-Interest
Subject: Re: Transaction question



I already replyed to this message but noticed that it never came through...
so here it is again...

Thanks for the earlier reply.
My reaction:
I understand what you do below, but how must I define all this, such that
- All me methods still have the "trans-attribute" set to Required (as
before).
- Only the new method B has the "trans-attribute" set to RequiredNew ?

So what I am looking for is, some kind of default "trans-attribute" for all
methods, if the trans-attribute" isn't defined for the method in the xml
file.
As in the example below, I need to specify the "trans-attribute" for ALL my
methods separately, which isn't a nice way, as I have a lot of methods, and
it is easy to forget one, especialy when you add a new method.
How do I do this ? (isn't there a way to set the "trans-attribute" property
for methods with a regular expression or something like that ??)

Eddie



----- Original Message -----
From: "Simon Evans" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Thursday, July 26, 2001 7:49 PM
Subject: RE: Transaction question


> 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