• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Exception when Transaction attribute is never

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
RemoteException will be thrown for remote clients and EJBException is thrown for local clients.
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
reply
    Bookmark Topic Watch Topic
  • New Topic