RE: Transaction question ?

2001-09-21 Thread Juan Lorandi (Chile)

No-- they're invoked in different transactions.
Transactional activity maps directly to threads-- that is, the thread's id
is the transaction id (so to speak).

HTH,

JP

 -Original Message-
 From: Stephen Davidson [mailto:[EMAIL PROTECTED]]
 Sent: Martes, 18 de Septiembre de 2001 13:32
 To: Orion-Interest
 Subject: Re: Transaction question ?
 
 
 Eddie wrote:
  
  Hellu,
  
  Please some help on the following transaction scenario ?:
  
  I am receing some information through a HTTP post method. 
 The servlet,
  running as part of a J2EE application, calls a EJB method 
 A. The EJB method
  does some little processing. After this, it checks some 
 conditions, and
  might do some more processing in an other EJB method B 
 depending on the
  conditions (in the same method still). I want to call 
 method B in a thread,
  such that the client, performing the HTTP request, isn't 
 waiting too long.
  So I want to start method  B in a thread, such that the 
 initial EJB method A
  returns. How does the transacion model looks like in this 
 case and it is
  wise to do it like this ? (My transaction attribute is set 
 to Required and I
  am using CMP).
  I mean, is EJB method B, that runs in the thread executed in a new
  transaction, as the initial EJB method A returns, or does 
 it run in the same
  db transaction as method A ?
  
  Eddie
 
 Hi Eddie.
 
 Launching threads in an EJB is against spec, as you may have noticed.
 
 What you may want to consider is using JMS.  
 
 You would want to set up the EJB as a MessageDrivenBean, and then
 have the onMessage call method B.
 
 My understanding is that you can preserve the transaction/across
 through a message.
 
 
 -Steve
 -- 
 Stephen Davidson
 Java Consultant
 Delphi Consultants, LLC
 http://www.delphis.com
 Phone: 214-696-6224 x208
 




Re: Transaction question ?

2001-09-18 Thread Stephen Davidson

Eddie wrote:
 
 Hellu,
 
 Please some help on the following transaction scenario ?:
 
 I am receing some information through a HTTP post method. The servlet,
 running as part of a J2EE application, calls a EJB method A. The EJB method
 does some little processing. After this, it checks some conditions, and
 might do some more processing in an other EJB method B depending on the
 conditions (in the same method still). I want to call method B in a thread,
 such that the client, performing the HTTP request, isn't waiting too long.
 So I want to start method  B in a thread, such that the initial EJB method A
 returns. How does the transacion model looks like in this case and it is
 wise to do it like this ? (My transaction attribute is set to Required and I
 am using CMP).
 I mean, is EJB method B, that runs in the thread executed in a new
 transaction, as the initial EJB method A returns, or does it run in the same
 db transaction as method A ?
 
 Eddie

Hi Eddie.

Launching threads in an EJB is against spec, as you may have noticed.

What you may want to consider is using JMS.  

You would want to set up the EJB as a MessageDrivenBean, and then
have the onMessage call method B.

My understanding is that you can preserve the transaction/across
through a message.


-Steve
-- 
Stephen Davidson
Java Consultant
Delphi Consultants, LLC
http://www.delphis.com
Phone: 214-696-6224 x208




Re: Transaction question

2001-08-07 Thread Eddie Post

Hellu,

Does someone knows if Orion supports a default transaction attribute as
specified in the EJB 2.0 spec.

Thanks Simon,
Eddie

- Original Message -
From: Simon Evans [EMAIL PROTECTED]
To: Orion-Interest [EMAIL PROTECTED]
Sent: Monday, August 06, 2001 6:40 PM
Subject: RE: Transaction question


 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
descriptionTransaction-handling for the
 SmsManager/description
ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
method-intfRemote/method-intf
method-name*/method-name
   /method
   trans-attributeRequired/trans-attribute
 /container-transaction
 container-transaction
   method
descriptionTransaction-handling for the
 SmsManager/description
ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
method-intfRemote/method-intf
method-nameB/method-name
   /method
   trans-attributeRequiresNew/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
descriptionTransaction-handling for the
 SmsManager/description
ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
method-intfRemote/method-intf
method-nameA/method-name
   /method
   trans-attributeRequired/trans-attribute
 /container-transaction
 container-transaction
   method
descriptionTransaction-handling for the
 SmsManager/description
ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
method-intfRemote/method-intf
method-nameB/method-name
   /method
   trans-attributeRequiresNew/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
descriptionTransaction-handling for the
  SmsManager/description
ejb

Re: Transaction question

2001-08-06 Thread Eddie Post


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
   descriptionTransaction-handling for the
SmsManager/description
   ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
   method-intfRemote/method-intf
   method-nameA/method-name
  /method
  trans-attributeRequired/trans-attribute
/container-transaction
container-transaction
  method
   descriptionTransaction-handling for the
SmsManager/description
   ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
   method-intfRemote/method-intf
   method-nameB/method-name
  /method
  trans-attributeRequiresNew/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
   descriptionTransaction-handling for the
 SmsManager/description
   ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
   method-intfRemote/method-intf
   method-name*/method-name
  /method
  trans-attributeRequired/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
 
 
 










RE: Transaction question

2001-08-06 Thread Seth Osher

Set up a default transaction-attribute for your bean.

This is from the EJB 2.0 draft.
Page 353
Section 17.4.1

Use a * for the method-name.

method
ejb-nameEJBNAME/ejb-name
method-name*/method-name
/method

- Seth
[EMAIL PROTECTED]

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Eddie Post
Sent: Monday, August 06, 2001 4: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
   descriptionTransaction-handling for the
SmsManager/description
   ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
   method-intfRemote/method-intf
   method-nameA/method-name
  /method
  trans-attributeRequired/trans-attribute
/container-transaction
container-transaction
  method
   descriptionTransaction-handling for the
SmsManager/description
   ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
   method-intfRemote/method-intf
   method-nameB/method-name
  /method
  trans-attributeRequiresNew/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
   descriptionTransaction-handling for the
 SmsManager/description
   ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
   method-intfRemote/method-intf
   method-name*/method-name
  /method
  trans-attributeRequired/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
 
 
 










RE: Transaction question

2001-08-06 Thread Simon Evans

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
   descriptionTransaction-handling for the
SmsManager/description
   ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
   method-intfRemote/method-intf
   method-name*/method-name
  /method
  trans-attributeRequired/trans-attribute
/container-transaction
container-transaction
  method
   descriptionTransaction-handling for the
SmsManager/description
   ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
   method-intfRemote/method-intf
   method-nameB/method-name
  /method
  trans-attributeRequiresNew/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
   descriptionTransaction-handling for the
SmsManager/description
   ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
   method-intfRemote/method-intf
   method-nameA/method-name
  /method
  trans-attributeRequired/trans-attribute
/container-transaction
container-transaction
  method
   descriptionTransaction-handling for the
SmsManager/description
   ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
   method-intfRemote/method-intf
   method-nameB/method-name
  /method
  trans-attributeRequiresNew/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
   descriptionTransaction-handling for the
 SmsManager/description
   ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
   method-intfRemote/method-intf
   method-name*/method-name
  /method
  trans-attributeRequired/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

Re: Transaction question

2001-08-06 Thread Eddie Post

Seth,

Thanks Seth I will try that, does the order in the xml file matters ? (first
the default, and than the customized transaction attributes for example ).

Eddie

- Original Message -
From: Seth Osher [EMAIL PROTECTED]
To: Orion-Interest [EMAIL PROTECTED]
Sent: Monday, August 06, 2001 4:57 PM
Subject: RE: Transaction question


 Set up a default transaction-attribute for your bean.

 This is from the EJB 2.0 draft.
 Page 353
 Section 17.4.1

 Use a * for the method-name.

 method
 ejb-nameEJBNAME/ejb-name
 method-name*/method-name
 /method

 - Seth
 [EMAIL PROTECTED]

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED]]On Behalf Of Eddie Post
 Sent: Monday, August 06, 2001 4: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
descriptionTransaction-handling for the
 SmsManager/description
ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
method-intfRemote/method-intf
method-nameA/method-name
   /method
   trans-attributeRequired/trans-attribute
 /container-transaction
 container-transaction
   method
descriptionTransaction-handling for the
 SmsManager/description
ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
method-intfRemote/method-intf
method-nameB/method-name
   /method
   trans-attributeRequiresNew/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
descriptionTransaction-handling for the
  SmsManager/description
ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
method-intfRemote/method-intf
method-name*/method-name
   /method
   trans-attributeRequired/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
  
  
  
 
 










Re: Transaction question

2001-07-26 Thread Eddie

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
  descriptionTransaction-handling for the
SmsManager/description
  ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
  method-intfRemote/method-intf
  method-name*/method-name
 /method
 trans-attributeRequired/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







RE: Transaction question

2001-07-26 Thread Juan Lorandi (Chile)

Bottom line... you can't do that. J2EE doesn't support nested transactions.
However, this may work in orion. for info on the descriptors, check out
Sun's EJB spec and orion documentation and DTD's. This is a rough draft of
how it would have to look like:

  container-transaction
 method
  descriptionTransaction-handling for the 
 SmsManager/description
  ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
  method-intfRemote/method-intf
  method-name*/method-name
 /method
 trans-attributeRequired/trans-attribute
   /container-transaction
  container-transaction
 method
  descriptionTransaction-handling for the 
 SmsManager/description
  ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
  method-intfRemote/method-intf
  method-name[YOUR_METHOD_HERE]/method-name
 /method
 trans-attributeRequiresNew/trans-attribute
   /container-transaction

therefore, all methods are marked as 'Required' but [YOUR_METHOD_HERE],
which is marked as 'RequiresNew'
 -Original Message-
 From: Eddie [mailto:[EMAIL PROTECTED]]
 Sent: Martes, 24 de Julio de 2001 4:47
 To: Orion-Interest
 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
  descriptionTransaction-handling for the 
 SmsManager/description
  ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
  method-intfRemote/method-intf
  method-name*/method-name
 /method
 trans-attributeRequired/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
 
 




RE: Transaction question

2001-07-26 Thread Simon Evans

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
  descriptionTransaction-handling for the SmsManager/description
  ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
  method-intfRemote/method-intf
  method-nameA/method-name
 /method
 trans-attributeRequired/trans-attribute
   /container-transaction
   container-transaction
 method
  descriptionTransaction-handling for the SmsManager/description
  ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
  method-intfRemote/method-intf
  method-nameB/method-name
 /method
 trans-attributeRequiresNew/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
  descriptionTransaction-handling for the
SmsManager/description
  ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
  method-intfRemote/method-intf
  method-name*/method-name
 /method
 trans-attributeRequired/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







RE: Transaction question

2001-07-26 Thread Simon Evans

sorry , thats what i meant...cut and paste mistake

-Original Message-
From: Juan Lorandi (Chile) [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 26, 2001 9:55 AM
To: Orion-Interest
Subject: RE: Transaction question


Bottom line... you can't do that. J2EE doesn't support nested transactions.
However, this may work in orion. for info on the descriptors, check out
Sun's EJB spec and orion documentation and DTD's. This is a rough draft of
how it would have to look like:

  container-transaction
 method
  descriptionTransaction-handling for the 
 SmsManager/description
  ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
  method-intfRemote/method-intf
  method-name[METHOD A]/method-name
 /method
 trans-attributeRequired/trans-attribute
   /container-transaction
  container-transaction
 method
  descriptionTransaction-handling for the 
 SmsManager/description
  ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
  method-intfRemote/method-intf
  method-name[METHOD_B]/method-name
 /method
 trans-attributeRequiresNew/trans-attribute
   /container-transaction

therefore, all methods are marked as 'Required' but [YOUR_METHOD_HERE],
which is marked as 'RequiresNew'
 -Original Message-
 From: Eddie [mailto:[EMAIL PROTECTED]]
 Sent: Martes, 24 de Julio de 2001 4:47
 To: Orion-Interest
 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
  descriptionTransaction-handling for the 
 SmsManager/description
  ejb-namenl.unwired.sgs.sms.SmsManager/ejb-name
  method-intfRemote/method-intf
  method-name*/method-name
 /method
 trans-attributeRequired/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