• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

setRollBackOnly

 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic