• 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

Dooming a transaction

 
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why dooming a transaction? can you tell me at what kind of senerio we use this ?
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"dooming" a transaction is not a term I've come accross. Where did you hear it? Are you talking about calling setRollbackOnly() after an application exception?
[ June 08, 2007: Message edited by: Paul Sturrock ]
 
Aaron Raja
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes I mean ejbContext.setRollbackOnly();

this call will force transaction to rollback but how it is used in the method below get me confusion

public void fireSettlementCalculation() throws Exception {
if ( ejbContext.getRollbackOnly() ) {
// transaction is doomed so return doing nothing
return;
}
else {
performSettlementCalculation();
}
}

In this if condition if is quilify to be true transaction is doomed already so return doing nothing if not do performSettlement Calculation, can we use this (ejbContext.getRollbackOnly() ) in if statement and if it is then senerio please to explain better way?
I am maintaing the code written by some interesting and so called smart EJB dude!!!
 
Paul Sturrock
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The purpose of getRollbackOnly() is to short cut failure. If you have a long transaction and something fails right at the start there is little point going through the extra processing only to roll back. Is it required? Not really.
 
Aaron Raja
Ranch Hand
Posts: 206
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks now it is clear to me! You made my day!!!
 
And will you succeed? Yes you will indeed! (98 and 3/4 % guaranteed) - Seuss. tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic