Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Valentin Crettaz's cheat sheets Exception Handling

 
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
 
Skool. Stay in. Smartness. Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic