This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP 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