Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BMT Transaction

 
Sandesh Tathare
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
BMT Transaction:
It's well known that a BMT bean(Stateless Session Bean or Message Driven Bean) must NOT complete a transactional method without ending the transaction.

I just want to know, what happens when a programmer miss on this. What type of exception is thrown by Container?
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Container will throw a javax.transaction.NotSupportedException from the begin() method if the previous transaction has not completed.

cheers,
Kathy
 
Paul Maessen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to the spec (17.6.1), for a SLSB a RemoteException or EJBException is thrown to the client.

For a MDB it doesn't make sense for the container to throw an exception (since there is no client to receive it).
 
Sandesh Tathare
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kathy, thanks once again.

Let me summarise what I have understood below:

If Bean Provider do not complete a transactional method without ending the transaction of a BMT bean(Stateless Session Bean or Message Driven Bean):
1] Container do not throw any exception
2] Subsequently, if an attempt is made to begin new Transaction without first completing previous transaction, javax.transaction.NotSupportedException is thrown.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic