Consider the following scenario : A client (within a Transaction scope) calls an EJB(say "x-ejb") which has Transaction Attribute = Required . Now this x-ejb calls another EJB(say "y-ejb"). y-ejb has Transaction Attribute = NotSupported....would the y-ejb be part of the transaction scope ? what would happen if y-ejb has Transaction Attribute = Never ?
posted 12 years ago
a) When the client which is already part of a transaction context calls a method of EJB-X with "REQUIRED" attribute, then the container will include the method execution as part of the same transaction context. When the method of EJB-X further calls a method of EJB-Y with the attribute "NOT_SUPPORTED" then the current transaction context will be suspended. The transaction will resme once the control is passed back to the calling method of EJB-X. b) The "NEVER" attribute definition states that the method with this transaction boundary should never be called by a client which is running in a transaction context. So in the above scenario the calling method of EJB-X will receive a RemoteException since it is associated with a transaction context.