Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB 2 BMT

 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I encountered a strange situation where the container was calling setRollbackOnly() after a runtime exception.(Okay I know that doesn't sound so strange)BUTwhat's confusing me is that the BMT method was not called from and did not start any transactions....So what happened was the method threw a runtime exception and then the container called setRollbackOnly().That's all well and good but what does that mean??If no transaction was started then what is it rolling back?
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

So what happened was the method threw a runtime exception and then the container called setRollbackOnly().That's all well and good but what does that mean??If no transaction was started then what is it rolling back?

That does sounds wierd. Its BMT, the bean is supposed to be managing the transaction so setRollbackOnly should not need to be called.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes...Maybe it's something specific that WAS 6 does??Because I'm pretty sure if I call setRollbackOnly() when there is no transaction I will get an IllegalStateException...
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It will do, if you are using CMT. But you are not.
 
Duran Harris
Ranch Hand
Posts: 608
Eclipse IDE Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So this is different from EJB 3.0?Here's an excerpt from EJB3.0 core specs:

13.3.3.1 getRollbackOnly and setRollbackOnly Methods
An enterprise bean with bean-managed transaction demarcation must not use the getRollbackOnly
and setRollbackOnly methods of the EJBContext interface.
An enterprise bean with bean-managed transaction demarcation has no need to use these methods,
because of the following reasons:
� An enterprise bean with bean-managed transaction demarcation can obtain the status of a
transaction by using the getStatus method of the javax.transaction.User-
Transaction interface.
� An enterprise bean with bean-managed transaction demarcation can rollback a transaction
using the rollback method of the javax.transaction.UserTransaction interface.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic