This week's giveaway is in the JDBC forum.
We're giving away four copies of Java Database Connections & Transactions (e-book only) and have Marco Behler on-line!
See this thread for details.
Win a copy of Java Database Connections & Transactions (e-book only) this week in the JDBC forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Knute Snortum
  • Paul Clapham
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Frits Walraven
Bartenders:
  • Ganesh Patekar
  • Tim Holloway
  • salvin francis

setRollBackOnly  RSS feed

 
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.
 
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.
 
All of the world's problems can be solved in a garden - Geoff Lawton. Tiny ad:
how do I do my own kindle-like thing - without amazon
https://coderanch.com/t/711421/engineering/kindle-amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!