Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NorSupportedException in BMT Stateful session beans

 
sid nagol
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
consider a business method in a stateful session bean with bean managed transaction

public void bussinessMethod()
{
UserTransaction ut = this.sessionContext.getUserTransaction();
ut.begin();
UserTransaction ut2 = this.sessionContext.getUserTransaction();
ut.begin();
}

is this code supposed to handle the transqaction related checked exceptiopns.
ut.begin() throws a javax.ejb.NotSupportedException which is a checked exception.
its obvious it must handle it, but i am asking to confirm that as none of the code samples i have looked at seems to be showing that.

thank you very much for you time, i really appreciate it.
sid
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You probably don't get the exception handling in the interest of code clarity. I would expect this code to throw NotSupportedException. This should be handled and setRollbackOnly() invoked.
 
Jesus Angeles
Ranch Hand
Posts: 2068
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
are you sure it is defined as bmt? not cmt?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic