• 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
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Forcing a transaction to rollback

 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a method in SessionContext interface: setRollBackOnly(Boolean b). Please anyone tell me what is the usage of this method? What is realy ment by "Forcing a transaction to rollback"? Thank you very much.
[ March 10, 2004: Message edited by: Nesan Krish ]
[ March 10, 2004: Message edited by: Nesan Krish ]
 
Ranch Hand
Posts: 418
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the bean has container managed transaction (CMT) demarcation, then the bean methods' transactions are managed by the container. you have to define the desired tx attribute in the deployment descriptor of the bean.
- Now if the container is managing tx for the bean, what if something goes wrong in the bean and if the bean does not want the container to commit the tx? in such a case, bean can use context.setRollBackOnly() method to indicate that the tx should /would not be commited. This is how the bean forces the tx to roll back
-Suppose a bean method m1 calls another method m2 on second bean having tx atribute Required, then the m1's tx xontext is passed to m2. suppos m2 wants to check if the tx has already bean set to roll back by m1, then it can use use context.getRollBackOnly()
Hope this makes clear.
[ March 10, 2004: Message edited by: Rashmi Tambe ]
 
Nesan Krish
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Rashmi! Your reply is very useful. Thank you very much.
 
You don't know me, but I've been looking all over the world for. Thanks to the help from this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic