Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setRollBackOnly

 
Dhondiba Joshi
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setRollBackOnly is defined in two interfaces UserTx and EjbContext, i guess.

so what is the reason for following 2 things to be true ?

1) A BMT Stateful bean can call ut.setRollBackOnly in ejbCreate() method.
2)A steless session bean can not call sc.setRollbackonly in setSeesionContext() method.
 
Raja Sagar Panamgipalli
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

1)Opinion for (1) Question:-
Spec says:

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.UserTransaction interface.
� An enterprise bean with bean-managed transaction demarcation can rollback a transaction using the rollback() method of the UserTransaction interface.

I think its like we are not supposed to interfere with the working of container.When we say we are going for BMT then we must pretty much adhere to it.

(2)Opinion for Question(2)

Stateless Session bean's creation and removal is tied to the container, so there may be an unspecified transaction context running during stateless session bean creation and context settings.
This may be the reason why we cannot call setRollbackOnly() on the SessionContext object.

Expect Corrections from all... :roll:

Regards,
Sagar.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic