Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

TransactionRequiredException

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
reply
    Bookmark Topic Watch Topic
  • New Topic