• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

System Exceptions and bean instances

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Let's say Bean A invokes a method in Bean B. Bean B throws a System Exception. Does the container discard both Bean A and Bean B? Or it just discard the bean that gets a System Exception (Bean A) not the System Exception originator (Bean B)?

Does the above outcomes change depending on the bean type (session or message driven)?

Please let me know. Thanks in advance.

Cheers,
Tyronne
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please study the tables in EJB Core Spec Chapter 14 , it clearly state out all the circumstances for application exception and system exception.

For a short answer, Bean A is the client , Bean B is having the bean method invoked by client. When bean method throw System Exception, only the bean which bean method declared on is discarded by container, that is Bean B.

Bean A does get the exception, but it is not the system exception throw from Bean B, the exception get by Bean A is the exception throw by container, which is different depend on transaction context:
[the below is for session bean]
(1) For bean method which invoked in client transaction context
- EJBTransactionRollbackException (local client)
- TransactionRollbackException (remote client which extends Remote)
(2) For bean method which invoked in new transaction context
- EJBException
- RemoteException (remote client which extends Remote)
(3) For bean method which invoked in unspecified transaction context (means no transaction)
- EJBException
- RemoteException (remote client which extends Remote)

[check it out yourself , if the transaction is BMT ...... also put in some hardwork for MDB also]


Please study EJB Core Spec, All The Best ~ !!!
 
Tyronne Fernando
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the quick reply Lee.
 
reply
    Bookmark Topic Watch Topic
  • New Topic