This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes EJB and Transactions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB and Transactions" Watch "EJB and Transactions" New topic

EJB and Transactions

Pappu Kumar
Ranch Hand

Joined: Oct 01, 2002
Posts: 69
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 ?
Razi Abbas

Joined: Apr 30, 2002
Posts: 9
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.
Consider Paul's rocket mass heater.
subject: EJB and Transactions
It's not a secret anymore!