Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring 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

TransactionRequiredException

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the method tx attribute is mandatory and if client calls it without tx then TxReqdExcpt is thrown by the container.
That means that the method call did not reach the bean at all.
Also the exception being sys. exception the tx has to be rolled back.
In that case would the poor bean instanced which remained untouched killed by the container?

Tejas
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tejas,
You are correct. The method call wont reach the bean at all. Container will figure that out and throws the exception.

And the caller bean will get the system exception so it will be removed not the callee bean but the caller bean.

Thanks,
Ugender


Is the method tx attribute is mandatory and if client calls it without tx then TxReqdExcpt is thrown by the container.
That means that the method call did not reach the bean at all.
Also the exception being sys. exception the tx has to be rolled back.
In that case would the poor bean instanced which remained untouched killed by the container?

Tejas
 
Tejastejas Gokhale
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So we have two opposite situation here:

1. When any system exception except TxReqdExcpt is thrown teh bean in which exception occured is discarded and caller bean just recieves the exception.
2. When TxReqdExcpt is thrown the caller bean is discarded.

Sounds confusing isn't it?
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I think a bean instance is discarded by the container when a method in the bean throws a system exception.However, the TransactionRequiredException is not thrown by the bean execution, but rather by the container.Hence there would be no reason for the callee bean instance to be discarded as it was never invoked.
However, the exception being thrown means a system exception has resulted due to execution of the method in the caller bean and hence it must be discarded.
Hence what Ugender has to say is fine.

Regards,
Paresh Vernekar
 
You're not going crazy. You're going sane in a crazy word. Find comfort in this 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