• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

TransactionRequiredException

 
Tejastejas Gokhale
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
 
Ugender Rekulampally
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?
 
paresh vernekar
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic