I have a Session Bean.  It performs 3 actions inside one of its methods.  2
of the actions are updates to Entity Beans.  The 3rd action is sending a
synchronous message to an external system.  I want to have these 3 actions
performed in a transaction.  I can see how the 2 entity bean updates will be
managed in the transaction; I don't know how to tell the container that the
transaction failed if the return value from sending a message to an external
system indicates failure.

So, if I have the following method on the Session Bean, MySessionBean:

MySessionBeanMethod()
{
  myEntityBean1.updateNum1(num1);
  myEntityBean2.updateNum2(num2);
  int status = sendMessageToExternalSystem(msg);
  if (status == 0)
     // make sure that transaction is rolled back
}

I can specify the following transaction attributes in the deployment
descriptor:
MySessionBean's MySessionBeanMethod:  Requires New
MyEntityBean1's updateNum1 method: Requires
MyEntityBean2's updateNum2 method: Requires

How do I ensure that if the MySessionBeanMethod(0 fails, that the whole
transaction is rolled back?

Thx,
Bill

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to