Search code examples
websphereejbjboss7.xjava-ee-6java-ee-5

Question about xa and transaction on ejbs


I have two question/doubt:

  1. If two ejbs are deployed in different ear or different applicationserver, and one call the other, they still required XA indipendent that each one use one or more db as ?

  2. if two ejbs are deployed in different server, both are annotated with trans type = required,and when teh first ejb call the second, a new transaction start or use the propagation of first ejb?

**My ejbs are deployed on Webpshere, Jboss, WebLogic and can be written with JEE 5/6/7 technology(EJB 2/3).

Thanks

Roberto


Solution

  • Regardless of how the EJBs are packaged (same or different EAR) or where they are deployed (same or different server), if the transaction type is Required (i.e. the default) then the transaction initiated by the first bean must flow to the second bean, or the call to the second bean must result in an error.

    The server vendor should make no difference, as the behavior is defined in the Transactions chapter of the EJB specification. However, if the call is between vendors, then it may be more likely that transaction context propagation is not supported, in which case the call to the second bean should be rejected with an exception.

    Basically, if the client (1st bean) is running in a transaction and calls to a second bean with "Required", then the transaction context must propagate to the second bean or result in an error.