• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception when Transaction attribute is never

 
Clifford Fernandes
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the attibute is mandatory and the method is called from a method that is without a transaction. A TransactionRequiredexception of TransactionRequiredLocalException is thrown..

What if the transaction attribute specified for the method is never and the method is called from a client that has a transaction. which exception will be thrown?
 
Vinay Raj
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
RemoteException will be thrown for remote clients and EJBException is thrown for local clients.
 
Valentin Crettaz
Gold Digger
Sheriff
Posts: 7610
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the EJB 2.1 Specification

17.6.2.6 Never

The Container invokes an enterprise Bean method whose transaction attribute is set to Never without a transaction context defined by the EJB specification. The client is required to call without a transaction context.
- If the client calls with a transaction context, the Container throws the java.rmi.RemoteException exception if the client is a remote client, or the javax.ejb.EJBException if the client is a local client.
- If the client calls without a transaction context, the Container performs the same steps as described in the NotSupported case.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic