• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Valentin Crettaz's cheat sheets Exception Handling  RSS feed

 
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

On the first page in the ExceptionHandling.pdf document, it is mentioned under the heading "Client View":

if(ctx.getRollbackOnly())
//impossible to commit tx
else
//do more work and commit tx

What is this ctx? Is it SessionContext/EntityContext? If the answer is yes then how the standalone/remote client (non-EJB) gets access to SessionContext/EntityContext? This can only be true this were a EJB making call on other EJB? Please clarify my doubt.

Thanks

-- Ravi
 
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A bean calling another bean may be called a client.

Any bean's way of knowing if 'setRollbakOnly()' has been called by some bean and/or method earlier is to query its own context by calling 'getRollbackOnly()'

So if Bean A calls Bean B,
1. Bean A is said to be a client of Bean B
2. Bean B might query its own context to check if any bean in the call stack has already called 'setRollbackOnly()'. If yes, Bean B might not go ahead with all the processing and waste time.

Regards,
Leena
 
ravi janap
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Leena

Thanks for the detailed explanation.

Regards

-- Ravi
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!