• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Transaction confusion

 
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to figure out when a client would actually get back a TransactionRolledbackException or TransactionRolledbackLocalException.
Here's a scenario that I'm wondering about:
CMT is used. A client with an existing transaction calls a method on a bean that has a Required transaction attribute and so the method runs in the client's transaction. The bean method throws a null pointer exception. Will the client stack trace show a TransactionRolledbackException for a remote call or a NullPointerException or both?
Could a client get a TransactionRolledbackException in a situation other than the above scenario?
 
Ranch Hand
Posts: 329
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

CMT is used. A client with an existing transaction calls a method on a bean that has a Required transaction attribute and so the method runs in the client's transaction. The bean method throws a null pointer exception. Will the client stack trace show a TransactionRolledbackException for a remote call or a NullPointerException or both?
Could a client get a TransactionRolledbackException in a situation other than the above scenario?


If setRollbackOnly() is called before system exception (nullpoint or any unexpected exception) then method won't throw TransactionRollbackedException().
If setRollbackOnly() isn't define in that case remote method call will get TransactionRolledbackException(). Remember remote client get RemoteException() for any system exception throw at server side and those are never pass as it is by server. (only application exception are pass as its by server to client).
Also refer page number 551 from Head First EJB for exception hierarchy.
Hope this help.
reply
    Bookmark Topic Watch Topic
  • New Topic